/* empty css       */import{o as n,c as a,a as i,d as l,_ as u}from"./index.js";const h={class:"impact-force"},d={class:"force-progress"},c=i("div",{class:"impact-force-icon"},null,-1);function f(e,s,t,o,r,B){return n(),a("div",h,[i("div",d,[i("div",{class:"force-progress-value",style:l({height:`${r.progressValue}%`})},null,4)]),c])}const p={name:"football-impact-force",props:["openParams"],data(){return{pressButton:[],progressValue:100,count:0,value:0,keyPressed:!1,timerId:null,keyUse:[69,81,32,1e3,1001]}},created(){if(this.openParams){const e=this.openParams.time;this.progressValue=100,this.value=100/(e/20),this.count=0,this.keyPressed=!1,this.pressButton=[];for(let s=0;s<this.keyUse.length;s++)this.pressButton[this.keyUse[s]]=!1}},mounted(){document.onkeyup=({keyCode:e})=>{this.keyUse.findIndex(t=>t==e)>=0&&this.pressButton[e]&&(e!=32&&this.clearPressBar(),this.pressButton[e]=!1,sendClientEvent(0,"FB_KeysState",0,e))},document.onkeydown=e=>{const s=e.keyCode;this.keyUse.findIndex(o=>o==s)>=0&&!this.pressButton[s]&&(s!=32&&!this.count&&this.setPressBar(),this.pressButton[s]=!0,sendClientEvent(0,"FB_KeysState",s,0))},document.addEventListener("mousedown",this.footballMouseClick,!1),document.addEventListener("mouseup",this.footballMouseClick,!0)},methods:{hitSound(e){e=="hit"&&window.playAdditionalSound("football/hit.wav"),e=="AverageHit"&&window.playAdditionalSound("football/average_hit.wav"),e=="ForceHit"&&window.playAdditionalSound("football/hard_hit.wav")},showPressBar(e){this.progressValue=100,this.value=100/(e/20),this.count=0,this.keyPressed=!1,this.key_mouse_l=9993,this.pressButton=[];for(let s=0;s<keyUse.length;s++)this.pressButton.keyUse[s]=!1},setPressBar(){this.timerId=setInterval(this.updatePressBar,20),this.keyPressed=!0},clearPressBar(){for(let e=0;e<2;++e)clearInterval(this.timerId-e);this.count=0,this.progressValue=100,this.keyPressed=!1},updatePressBar(){this.count+=1;let e=this.value+this.count;e>=200&&this.clearPressBar(),e>100&&(e=200-e),this.count+=this.value,this.progressValue=100-e},footballMouseClick({button:e,type:s}){e===2&&(s==="mousedown"&&!this.pressButton[1e3]?(this.count||this.setPressBar(),this.pressButton[1e3]=!0,sendClientEvent(0,"FB_KeysState",e,0)):s==="mouseup"&&this.pressButton[1e3]&&(this.clearPressBar(),this.pressButton[1e3]=!1,sendClientEvent(0,"FB_KeysState",0,e))),e||(s==="mousedown"&&!this.pressButton[1001]?(this.pressButton[1001]=!0,sendClientEvent(0,"FB_KeysState",9993,0)):s==="mouseup"&&this.pressButton[1001]&&(this.pressButton[1001]=!1,sendClientEvent(0,"FB_KeysState",0,9993)))}}},v=u(p,[["render",f]]);export{v as default};
