var dialog={create:function(t,{name:e="NAME",text:i="TEXT",btnText:n="WEITER",voiceover:a="ButtonClick",hasEnded:o=!0,hasButton:s=!0,nextLine:d=null,sprite:r="DialogChar",callback:c={before:null,after:null}}){t.intervalId=null,this.voiceover=a,this.sc=t,this.animationSpeedFactor=.35,this.cb=c,this.mText=i,this.nextLine=d,t.scene.get("Modal").blockInputs(),null!=this.voiceover&&0!=this.voiceover&&t.audioplayer.playSound(this.voiceover,{}),null!=this.cb.before&&(t.tmpFunc=new Function(this.cb.before),t.tmpFunc()),t.dZoneBG=t.add.rectangle(0,0,width,height,0),t.dZoneBG.setAlpha(.8),t.dZoneBG.setOrigin(0),t.dZone=t.add.zone(0,0,width,height).setOrigin(0).setInteractive().on("pointerup",(function(){})),t.dChar=t.add.image(250,height-150,r),t.dBG=t.add.image(centerX+50,height-170,"DialogBG"),t.dBtn=t.add.image(t.dBG.x+450,t.dBG.y+110,"DialogBtn"),t.dName=t.add.image(t.dBG.x-250,t.dBG.y-140,"DialogNameBG");t.dTextName=t.add.text(t.dName.x-210,t.dName.y,e,{fontFamily:"FontBold",color:"#000",fontSize:"42px"}),t.dTextName.setOrigin(0,.5),t.dTextButton=t.add.text(t.dBtn.x,t.dBtn.y,n,{fontFamily:"FontBold",color:"#000",fontSize:"36px"}),t.dTextButton.setOrigin(.5),t.dText=t.add.text(t.dBG.x-470,t.dBG.y-80,"",{fontFamily:"FontMedium",color:"#000",fontSize:"32px",wordWrap:{width:.5*width}}),t.dText.setOrigin(0),t.tweens.add({targets:[t.dZoneBG],alpha:{start:0,from:0,to:.8},ease:"Sine.InOut",duration:500*this.animationSpeedFactor}),t.tweens.add({targets:[t.dBG,t.dChar],alpha:{start:0,from:0,to:1},ease:"Sine.InOut",duration:1e3*this.animationSpeedFactor}),t.tweens.add({targets:[t.dChar],x:{start:-250,from:-250,to:250},ease:"Sine.InOut",duration:1e3*this.animationSpeedFactor}),t.tweens.add({targets:[t.dBG],y:{start:height+170,from:height+170,to:height-170},ease:"Sine.InOut",duration:1e3*this.animationSpeedFactor,delay:500*this.animationSpeedFactor}),t.tweens.add({targets:[t.dTextName,t.dTextButton,t.dText,t.dBtn,t.dName],alpha:{start:0,from:0,to:1},ease:"Sine.InOut",duration:250*this.animationSpeedFactor,delay:1e3*this.animationSpeedFactor,onComplete:()=>{this.typewrite(t,t.dText,i,t.intervalId),t.dBtn.setInteractive({useHandCursor:!0}),t.scene.get("Modal").blockInputs(!1)}}),s||(t.dBtn.setVisible(!1),t.dTextButton.setVisible(!1));var l=this;return t.dBtn.on("pointerup",(function(){if(null!=l.sc.intervalId)return clearInterval(l.sc.intervalId),l.sc.intervalId=null,void(l.sc.dText.text=l.mText);null!=l.nextLine&&0!=l.nextLine?(l.sc.dText.text="",setTimeout((()=>{l.sc.scene.get("DialogManager").events.emit("nextLine")}),25)):l.closeMe()})),this},newText:function(t){this.sc.dText.text="",this.cb=t.callback,this.mText=t.text,this.nextLine=t.nextLine,this.voiceover=t.voiceover,this.sc.audioplayer.stopSounds(),null!=this.voiceover&&0!=this.voiceover&&this.sc.audioplayer.playSound(this.voiceover,{}),this.typewrite(this.sc,this.sc.dText,this.mText,this.sc.intervalId)},closeMe:function(){var t=this;this.sc.audioplayer.playSFX("ButtonClick"),null!=this.voiceover&&0!=this.voiceover&&this.sc.audioplayer.stopSound(this.voiceover),clearInterval(this.sc.intervalId),this.sc.scene.get("Modal").blockInputs(),this.sc.dZone.destroy(),this.sc.tweens.add({targets:[this.sc.dChar],x:{from:250,to:-250},ease:"Sine.InOut",duration:1e3*this.animationSpeedFactor,onComplete:function(){for(var e of(null!=t.cb.after&&"null"!=t.cb.after&&(t.sc.tmpFunc=new Function(t.cb.after),t.sc.tmpFunc(),t.sc.tmpFunc=null),setTimeout((()=>{t.sc.scene.get("Modal").blockInputs(!1)}),250),this.targets))e.destroy()}}),this.sc.tweens.add({targets:[this.sc.dZoneBG],alpha:{from:.8,to:0},ease:"Sine.InOut",duration:500*this.animationSpeedFactor,onComplete:function(){for(var t of this.targets)t.destroy()}}),this.sc.tweens.add({targets:[this.sc.dBG,this.sc.dTextName,this.sc.dTextButton,this.sc.dText,this.sc.dBtn,this.sc.dName],y:"+=500",ease:"Sine.Out",duration:500*this.animationSpeedFactor,onComplete:function(){for(var t of this.targets)t.destroy()}})},typewrite:function(t,e,i){var n=0,a=i.length;t.intervalId=setInterval((()=>{n<=a?(t.dText.text=i.substring(0,n),n++):(clearInterval(t.intervalId),t.intervalId=null,t.scene.get("Modal").blockInputs(!1))}),25)}};
//# sourceMappingURL=index.820d1e7a.js.map
