parkour.min.js 21 KB

1
  1. function _runTime(){var t=setInterval(function(){vm.timeCount+=31,vm.costSeconds=_formatSecond(vm.timeCount)},31);timerArray.push(t)}function _formatSecond(t){return Math.floor(t/1e3)+"."+Math.floor(t%1e3/100)+(t%10>0?t%10:0)}function _initRunview(){$("#obstacle-prompt").height(160*$("#obstacle-prompt").width()/300)}function _initLoader(){var t=new resLoader({resources:["./img/article/accelerator.png","./img/article/bomb.png","./img/article/car.png","./img/article/pool.png","./img/article/roadblock.png","./img/article/star.png","./img/countdown_bg_1.png","./img/countdown_bg_2.png","./img/countdown_bg_3.png","./img/game_head_bg.png","./img/head_bg.png","./img/main_bg.jpg","./img/new_bg.jpg","./img/main_bottom_bg.png","./img/main_obstacle.png","./img/person_die_1.png","./img/person_die_2.png","./img/person_nm_1.png","./img/person_nm_2.png","./img/person_sl_1.png","./img/person_sl_2.png","./img/person_sp_1.png","./img/person_sp_2.png","./img/person_st_1.png","./img/person_st_2.png","./img/runway_bg.jpg","./img/runway_start.jpg","./img/toggle_way.png","./img/friend_bg.png","./img/rule_bg.png","./img/lucky_main.png","./img/gameover_bg.png","./img/loading.png","./img/lucky_btn_begin.png","./img/share_content.png","./img/card_back.png","./img/rule_bg.png","./img/draw_failed_bg.png","./img/draw_result.png","./img/draw_result_real.png","./img/gift_list_bg.png","./img/input_arrow.png","./img/mygift_bg.png","./img/lucky_btn_loading.png","./img/destination_bg.png","./img/rule.jpg","./img/gift_list.jpg"],onProgress:function(t,e){vm.preloadPercent=Math.floor(t/e*100)},onComplete:function(t){$("#load-progress").hide(),$("#main-bottom").show(),gameMonitor.init()}});t.start()}function _initData(){var t=$(window).width();$("body").height($(window).height()),$("#main-bottom").height(504*t/640)}function _initBroadcast(){var t=0,e=0;$("#broadcast").css("visibility","hidden"),setTimeout(function(){$("#broadcast").css("visibility","visible")},500);var i=setInterval(function(){if($("#broadcast .broadcast-slide").length<1)return!1;var i=0;$("#broadcast .broadcast-slide").each(function(){i+=$(this).width()+20}),$("#broadcast .broadcast-wrapper").width(i),t-=3,$("#broadcast .broadcast-wrapper").css("margin-left",t+"px");var r=$("#broadcast .broadcast-slide").eq(e+1).offset().left;if(r<0){var o='<div class="broadcast-slide">'+$("#broadcast .broadcast-slide").eq(e).html()+"</div>";$("#broadcast .broadcast-wrapper").append(o);var n=$("#broadcast .broadcast-slide").eq(e).width()+20,s=$("#broadcast .broadcast-wrapper").width();$("#broadcast .broadcast-wrapper").width(s+n),e++}},100);timerArray.push(i)}function _gameover(){$("#popup-game-result").show(),$("#popup-container").show(),_resizePopup()}function _resizePopup(){$("#popup-rule").height(829*$("#popup-rule").width()/581),$("#popup-friend").height(729*$("#popup-friend").width()/581),$("#popup-lucky").height(709*$("#popup-lucky").width()/583),$("#popup-game-result").height(709*$("#popup-game-result").width()/583),$("#gift-list").height(750*$("#gift-list").width()/501),$("#draw-result").height($("#draw-result").width()),$("#popup-my-gift").height(709*$("#popup-my-gift").width()/583),$("#draw-failed").height(360*$("#draw-failed").width()/501),$("#draw-result-real").height(841*$("#draw-result-real").width()/581)}function _alert(t){vm.alertText=t,$("#alert").show(),setTimeout(function(){$("#alert").hide()},2e3)}function handleShowRule(){$("#popup-rule").show(),$("#popup-container").show(),_resizePopup()}function handleShowFriends(){$("#popup-friend").show(),$("#popup-container").show(),_resizePopup()}function handleShowLucky(){$("#popup-lucky").show(),$("#popup-container").show(),_resizePopup()}function handleClosePopup(t){$("#popup-container .popup-item").hide(),$("#popup-container").hide()}function showSharePrompt(){$("#get-life").show()}function handleHideSharePrompt(){$("#get-life").hide()}function handleReturnMain(){manAnimateTimer&&(clearInterval(manAnimateTimer),manAnimateTimer=0),$("#running-man").removeClass("left").removeClass("right"),$("#count-down").attr("class","bg-3"),vm.manState="nm",vm.totalGameScore=vm.costSeconds=vm.timeCount=vm.runwayPosition=vm.baseScore=vm.curIntegral=vm.timeScore=0,$("#view-main").show(),$("#view-game").hide(),handleClosePopup(),_initBroadcast(),gameMonitor.init()}function handleBeginDraw(){return vm.totalIntegral<100?void _alert("您当前的积分不足,请参与跑步积分赛获取积分。"):void($("#popup-lucky .btn-begin-luck").hasClass("loading")||(giftListLock=!0,vm.totalIntegral-=100,$("#popup-lucky .game-item img").prop("src","./img/card_back.png"),$("#popup-lucky .btn-begin-luck").addClass("loading"),$.ajax({url:"/dubbo_api/mll/olympicRun/luckyDraw",type:"GET",dataType:"json",data:{}}).done(function(t){if(1==t.error)_alert(t.msg),$("#popup-lucky .btn-begin-luck").removeClass("loading"),giftListLock=!1;else if(2==t.error)_showDrawResult(0,t.goodsName),$("#popup-lucky .btn-begin-luck").removeClass("loading"),giftListLock=!1;else{var e=$$.__IMG+"/"+t.goodsPic,i=new Image;i.src=e,i.onload=function(){$("#popup-lucky .game-item").eq(0).addClass("back"),setTimeout(function(){$("#popup-lucky .game-item img").eq(0).prop("src",e),$("#popup-lucky .game-item").eq(0).removeClass("back")},600),setTimeout(function(){$("#popup-lucky .game-item").eq(1).addClass("back"),setTimeout(function(){$("#popup-lucky .game-item img").eq(1).prop("src",e),$("#popup-lucky .game-item").eq(1).removeClass("back")},600)},1e3),setTimeout(function(){$("#popup-lucky .game-item").eq(2).addClass("back"),setTimeout(function(){$("#popup-lucky .game-item img").eq(2).prop("src",e),$("#popup-lucky .game-item").eq(2).removeClass("back"),setTimeout(function(){$("#popup-lucky .btn-begin-luck").removeClass("loading");var e=0==t.goodsType?2:1;_showDrawResult(e,t.goodsName,t),giftListLock=!1},500)},600)},2e3)}}})))}function _showDrawResult(t,e,i){0==t?_showSecondaryPopup("draw-failed"):1==t?($("#draw-result .value").text(e),_showSecondaryPopup("draw-result"),handleClosePopup()):2==t&&(_showDrawRealPopup(e,i),handleClosePopup())}function _showDrawRealPopup(t,e){return $("#draw-result-real .text").text(t),_showSecondaryPopup("draw-result-real"),e.userInfo?($("#user-name").val(e.userInfo.realName),$("#user-phone").val(e.userInfo.mobile),$("#user-expr").val(e.userInfo.exprName),$("#user-info .draw-result-input").prop("disabled","disabled"),$("#user-info").click(function(){_alert("您已经设置过领奖信息,不能重复设置哦!")}),isSubmitUserInfo=!0,!1):($("#user-phone").on("keyup",function(){var t=$(this).val();/(13|14|15|18|17)[0-9]{9}/.test(t)&&$.ajax({url:"/dubbo_api/mll/eurocup/getExprAddr",type:"GET",dataType:"json",data:{mobile:t},success:function(t){if(0===t.error){var e=t.cityId,i=t.provinceId;$.ajax({url:"/mll_api/ajax_ajax.html?act=getSmsExprList",type:"GET",dataType:"json",success:function(t){var r,o,n=t[i].cityList[e];n?(n=n.exprList,r=Object.keys(n)[0],o=n[r]):(n=t[i].cityList,r=Object.keys(n)[0],n=t[i].cityList[r].exprList,r=Object.keys(n)[0],o=n[r]),$("#user-expr").val(o),$("#user-expr").data("exprid",r)}})}}})}),void $("#user-expr-container").off("click").on("click",function(){return event.preventDefault(),!e.userInfo&&void setTimeout(function(){new GSlider},200)}))}function handleSubmitUserMsg(){if(isSubmitUserInfo)return handleCloseDrawPopup(),!1;var t=$("#user-name").val(),e=$("#user-phone").val(),i=$("#user-expr").data("exprid");return t.length<1?(_alert("请填写姓名!"),!1):e.length<1?(_alert("请填写手机号!"),!1):11!=e.length?(_alert("请输入正确的手机号!"),!1):/(13|14|15|18|17)[0-9]{9}/.test(e)?i?($.ajax({url:"/dubbo_api/mll/olympicRun/addreceiveBaseInfo",type:"POST",dataType:"json",data:{realName:t,mobile:e,exprId:i}}).done(function(t){_alert(t.error?t.msg:"领奖信息提交成功!")}),void handleCloseDrawPopup()):(_alert("请选择体验馆!"),!1):(_alert("请输入正确的手机号!"),!1)}function handleCloseDrawPopup(){handleCloseSecondaryPopup(),$("#popup-lucky .game-item img").prop("src","./img/card_back.png")}function handleShowAllGift(){return!giftListLock&&($("#popup-secondary").show(),$("#gift-list").show(),void _resizePopup())}function _showSecondaryPopup(t){$("#popup-secondary").show(),$("#"+t).show(),_resizePopup()}function handleCloseSecondaryPopup(){$("#popup-secondary").hide(),$(".secondary-popup-item").hide()}function handleCloseDraw(){$("#popup-lucky .game-item img").prop("src","./img/card_back.png"),handleClosePopup()}function handleShowMyGift(){$("#popup-my-gift").show(),$("#popup-container").show(),_resizePopup(),$.ajax({url:"/dubbo_api/mll/olympicRun/getMyPrizeList",type:"GET",dataType:"json",data:{}}).done(function(t){t.prizesList&&(vm.myGiftList=t.prizesList)})}function _initWechat(t,e){wx.onMenuShareAppMessage({title:e.subject,desc:e.subhead,link:"http://m.meilele.com/dubbo_api/mll/wx/act/aypbPageshare?sourceid="+userOpenid+"&from_id="+window.fromId,imgUrl:t,type:"",dataUrl:"",success:function(){},cancel:function(){}}),wx.onMenuShareTimeline({title:e.subject,link:"http://m.meilele.com/dubbo_api/mll/wx/act/aypbPageshare?sourceid="+userOpenid+"&from_id="+window.fromId,imgUrl:t,success:function(){},cancel:function(){}})}var timerArray=[],userOpenid="",speedNormal=0,speedQuick=0,speedSlow=0,runSpeed=0,runDistance=0,obstacleTimer="",startLineHeight=0,swipeLock=!0,giftListLock=!1,vertigoMs=2e3,manAnimateTimer=0,isSubmitUserInfo=!1,afId="";!function(){for(var t=["webkit","moz"],e=0;e<t.length&&!window.requestAnimationFrame;++e)window.requestAnimationFrame=window[t[e]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[e]+"CancelAnimationFrame"]||window[t[e]+"CancelRequestAnimationFrame"]}(),$(document).ready(function(){$("body").show(),_initLoader(),_initData()});var vm=avalon.define({$id:"parkour",alertText:"",runwayPosition:0,timeCount:0,costSeconds:0,manState:"nm",manToggleType:1,manToggleInterval:130,curIntegral:0,totalLife:100,totalIntegral:0,preloadPercent:0,friendsList:[],friendsNum:0,userName:"",vertigoTime:"2s",baseScore:0,timeScore:0,giftList:[],myGiftList:[],broadcastList:[],totalGameScore:0,accidentPrompt:"",frameRate:0}),blockData={star:{width:.4,height:79/85,src:"./img/article/star.png"},speed:{width:.34,height:78/70,src:"./img/article/accelerator.png"},roadblock:{width:.7,height:63/142,src:"./img/article/roadblock.png"},bomb:{width:.5,height:97/93,src:"./img/article/bomb.png"},pool:{width:.7,height:63/145,src:"./img/article/pool.png"},car:{width:.5,height:76/98,src:"./img/article/car.png"}},Block=function(t,e,i,r,o,n,s){var a=new Image;a.src=n,this.type=t,this.left=e,this.top=i,this.width=r,this.height=o,this.src=a,this.id=s,this.isShow=!1};Block.prototype.paint=function(t){var e=this;this.src.onload=function(){t.drawImage(e.src,e.left,e.top,e.width,e.height)}},Block.prototype.move=function(t){this.top+=gameMonitor.bgSpeed,this.top>gameMonitor.h?gameMonitor.blockList[this.id]=null:this.top>0&&(this.isShow=!0,t.drawImage(this.src,this.left,this.top,this.width,this.height))};var Scale=function(t,e){this.ordinate=t,this.text="-"+e+"m"};Scale.prototype.move=function(t){this.ordinate+=gameMonitor.bgSpeed,this.ordinate>0&&this.ordinate<gameMonitor.h&&t.fillText(this.text,0,this.ordinate)};var gameMonitor={w:$(window).width(),h:$(window).height(),bgDistance:0,bgAdditionHeight:0,bgAdditionDistance:0,runner:{},frameCount:0,swipeLock:!0,totalDistance:0,runwayLength:0,bgSpeed:0,baseSpeed:0,blockList:[],runActTimer:"",startLineHeight:0,scaleHeight:0,scaleList:[],isInit:!1,speedNormal:0,speedFast:0,speedSlow:0,collisionTimer:"",endLine:{},rafId:"",lastTime:0,init:function(){var t=this,e="";this.lastTime=0,this.w=$(window).width(),this.h=$(window).height(),this.isInit||(e+='<canvas id="stage" width="'+this.w+'" height="'+this.h+'"></canvas>',$("#view-game").append(e));var i=document.getElementById("stage"),r=i.getContext("2d");r.clearRect(0,0,t.w,t.h),this.totalDistance=this.runwayLength=15*this.w,this.baseSpeed=this.speedNormal=this.bgSpeed=Math.round(this.runwayLength/1500),this.speedFast=Math.round(7*this.speedNormal/4),this.speedSlow=Math.round(this.speedNormal/4),this.startLineHeight=120*this.w/640,this.scaleHeight=this.runwayLength/20,this.initBg(r),this.initEndline(),this.isInit||(this.initListener(r),this.isInit=!0)},initBg:function(t){var e=this,i=new Image;this.bgDistance=0,this.bg=new Image,this.bg.src="./img/new_bg.jpg",this.bg.onload=function(){t.drawImage(e.bg,0,0,e.w,e.h)},i.src="./img/runway_bg.jpg",this.bgAddition=i,this.bgAdditionHeight=721*this.w/640,this.bgAdditionDistance=0-this.bgAdditionHeight,this.initScale(t),this.initBlock(t,function(t){e.initRunner(t)})},initEndline:function(t){this.endLine=new Image,this.endLine.src="./img/destination_bg.png",this.endLine.height=this.w/660*109},initScale:function(t){t.font="bold 18px 苹方",t.fillStyle="#d26b60",t.fillText("-5m",0,this.h-this.startLineHeight-this.scaleHeight),t.fillText("-10m",0,this.h-this.startLineHeight-2*this.scaleHeight),this.scaleList=[];for(var e=1;e<=20;e++){var i=this.h-this.startLineHeight-this.scaleHeight*e,r=new Scale(i,5*e);this.scaleList.push(r)}},initRunner:function(t){var e=this;this.runner=new Object,this.runner.size=[.2*this.w,.2*this.w*190/130],this.runner.centerPositon=(this.w-this.runner.size[0])/2,this.runner.leftPosition=(this.w/3-this.runner.size[0])/2,this.runner.rightPositon=this.w/3*2+(this.w/3-this.runner.size[0])/2,this.runner.positon=[this.runner.centerPositon,this.h-this.runner.size[1]],this.runner.animateState=1;var i={normal:"./img/person_nm_",fast:"./img/person_sp_",slow:"./img/person_sl_",stop:"./img/person_st_",die:"./img/person_die_"};for(var r in i){this.runner[r]=new Object;for(var o=1;o<3;o++)this.runner[r][o]=new Image,this.runner[r][o].src=i[r]+o+".png"}this.runner.curState="normal",this.runner.normal[1].onload=function(){t.drawImage(e.runner.normal[1],e.runner.positon[0],e.runner.positon[1],e.runner.size[0],e.runner.size[1])}},initListener:function(t){var e=this;$("#btn-begin").click(function(){if(vm.totalLife<1)return void _alert("您当前的生命值不足,请点击右上角分享,邀请好友获取生命值。");vm.totalLife--,$("#view-main").hide(),$("#view-game").show(),$("#count-down").show();var i=3,r=setInterval(function(){i--,0==i?(clearInterval(r),$("#count-down").hide(),e.run(t),_runTime()):$("#count-down").attr("class","bg-"+i)},1e3)}),this.initTouchEvent()},initTouchEvent:function(){var t=this;touch.on("#view-game","touchstart",function(t){t.preventDefault()}),touch.on("#view-game","swipeup",function(t){t.preventDefault()}),touch.on("#view-game","swipedown",function(t){t.preventDefault()}),touch.on("#view-game","swipeleft",function(e){return e.preventDefault(),!t.swipeLock&&("left"!=t.runner.swipeState&&void("right"==t.runner.swipeState?(t.runner.swipeState="center",t.runner.positon[0]=t.runner.centerPositon):(t.runner.swipeState="left",t.runner.positon[0]=t.runner.leftPosition)))}),touch.on("#view-game","swiperight",function(e){if(e.preventDefault(),t.swipeLock)return!1;if("left"==t.runner.swipeState)t.runner.swipeState="center",t.runner.positon[0]=t.runner.centerPositon;else{if("right"==t.runner.swipeState)return!1;t.runner.swipeState="right",t.runner.positon[0]=t.runner.rightPositon}})},initBlock:function(t,e){var i=this;i.blockList=[];var r=0,o=[];o=Math.random()>.5?[[{type:"star",row:6},{type:"roadblock",row:13},{type:"star",row:22},{type:"pool",row:26},{type:"star",row:35},{type:"speed",row:37},{type:"speed",row:44},{type:"star",row:56},{type:"car",row:71},{type:"speed",row:80},{type:"star",row:83},{type:"pool",row:88},{type:"pool",row:97},{type:"star",row:99}],[{type:"star",row:1},{type:"star",row:5},{type:"star",row:8},{type:"star",row:10},{type:"star",row:16},{type:"star",row:45},{type:"star",row:51},{type:"pool",row:58},{type:"pool",row:65},{type:"star",row:68},{type:"star",row:73},{type:"star",row:75},{type:"star",row:76},{type:"speed",row:77},{type:"speed",row:84},{type:"pool",row:90},{type:"star",row:97}],[{type:"roadblock",row:9},{type:"roadblock",row:25},{type:"star",row:28},{type:"star",row:35},{type:"star",row:37},{type:"star",row:38},{type:"speed",row:41},{type:"star",row:42},{type:"star",row:48},{type:"roadblock",row:55},{type:"star",row:58},{type:"star",row:64},{type:"pool",row:72},{type:"star",row:74},{type:"pool",row:78},{type:"star",row:83},{type:"bomb",row:86}]]:[[{type:"star",row:1},{type:"star",row:15},{type:"speed",row:31},{type:"speed",row:39},{type:"star",row:41},{type:"star",row:45},{type:"star",row:49},{type:"star",row:55},{type:"pool",row:61},{type:"star",row:63},{type:"speed",row:70},{type:"star",row:73},{type:"car",row:76},{type:"star",row:79},{type:"star",row:81},{type:"roadblock",row:84},{type:"star",row:88},{type:"star",row:89},{type:"speed",row:94}],[{type:"star",row:1},{type:"star",row:8},{type:"star",row:30},{type:"pool",row:34},{type:"star",row:38},{type:"star",row:39},{type:"bomb",row:46},{type:"star",row:49},{type:"pool",row:52},{type:"star",row:57},{type:"speed",row:59},{type:"star",row:61},{type:"pool",row:75},{type:"star",row:79},{type:"star",row:82},{type:"roadblock",row:87},{type:"speed",row:96}],[{type:"star",row:5},{type:"star",row:8},{type:"pool",row:21},{type:"star",row:23},{type:"star",row:25},{type:"star",row:31},{type:"pool",row:35},{type:"roadblock",row:55},{type:"roadblock",row:64},{type:"pool",row:72},{type:"star",row:76},{type:"pool",row:82}]],$.each(o,function(t,e){var o=0,n=i.w/3;o=0==t?0:1==t?n:2*n,$.each(e,function(t,e){var s=blockData[e.type],a=s.width*n,p=new Block(e.type,(n-a)/2+o,i.h-e.row/100*i.runwayLength-i.startLineHeight,s.width*n,a*s.height,s.src,r++);i.blockList.push(p)})});for(var n=0;n<i.blockList.length;n++){var s=i.blockList[n];s&&s.paint(t)}e(t)},rollBg:function(t){this.bgDistance+=this.bgSpeed,this.bgDistance<this.h&&t.drawImage(this.bg,0,this.bgDistance,this.w,this.h),this.bgAdditionDistance+=this.bgSpeed;for(var e=0;e<100&&(t.drawImage(this.bgAddition,0,this.bgAdditionDistance-e*this.bgAdditionHeight,this.w,this.bgAdditionHeight),!(this.bgAdditionDistance-e*this.bgAdditionHeight<=0));e++);},drawRunner:function(t){this.frameCount%10==0&&(1==this.runner.animateState?this.runner.animateState=2:this.runner.animateState=1),t.drawImage(this.runner[this.runner.curState][this.runner.animateState],this.runner.positon[0],this.runner.positon[1],this.runner.size[0],this.runner.size[1])},drawScale:function(){ctx.fillText("-10m",0,this.h-this.startLineHeight-2*this.scaleHeight)},collisionTest:function(){for(var t=0;t<this.blockList.length;t++)if(this.blockList[t]&&this.blockList[t].isShow){var e=this.blockList[t],i=[this.runner.positon[0]+this.runner.size[0]/2,this.runner.positon[1]+this.runner.size[1]/2],r=[e.left+e.width/2,e.top+e.height/2];Math.abs(i[0]-r[0])<(this.runner.size[0]+e.width)/2&&Math.abs(i[1]-r[1])<(this.runner.size[1]+e.height)/2&&(this.handleCollision(e.type),this.blockList[t]=null)}},handleCollision:function(t){var e=this;if("star"==t)vm.curIntegral++;else if("speed"==t)this.baseSpeed=this.speedFast,this.runner.curState="fast",this.collisionRecover();else if("roadblock"==t){this.baseSpeed=0,this.runner.curState="stop",this.swipeLock=!0,$("#obstacle-prompt").show(),$("#obstacle-prompt").height(160*$("#obstacle-prompt").width()/300);var i=setInterval(function(){vertigoMs-=100,vm.vertigoTime=vertigoMs%1e3>0?vertigoMs/1e3:vertigoMs/1e3+".0",vertigoMs<=0&&(vm.manState="nm",e.swipeLock=!1,$("#obstacle-prompt").hide(),vertigoMs=2e3,clearInterval(i))},100);this.collisionRecover()}else"pool"==t?(this.baseSpeed=this.speedSlow,this.runner.curState="slow",this.collisionRecover()):"car"!=t&&"bomb"!=t||(this.baseSpeed=0,this.runner.size=[.2*this.w,.2*this.w*159/143],this.runner.curState="die",this.swipeLock=!0,setTimeout(function(){e.endRun()},300))},collisionRecover:function(){var t=this;this.collisionTimer&&clearTimeout(this.collisionTimer),this.collisionTimer=setTimeout(function(){t.runner.curState="normal",t.baseSpeed=t.speedNormal,t.swipeLock=!1},2e3)},drawEndLine:function(t){this.runwayLength+this.runner.size[1]+this.h>0&&t.drawImage(this.endLine,0,0-(this.runwayLength+this.runner.size[1])+this.h,this.w,this.endLine.height)},run:function(t){function e(){var r=(new Date).getTime();i.lastTime>0&&(i.bgSpeed=i.baseSpeed*(60*(r-i.lastTime)/1e3)),i.lastTime=r,t.clearRect(0,0,i.w,i.h),i.rollBg(t),i.drawEndLine(t);for(var o=0;o<i.scaleList.length;o++){var n=i.scaleList[o];n&&n.move(t)}for(var o=0;o<i.blockList.length;o++){var s=i.blockList[o];s&&s.move(t)}return i.frameCount++,i.drawRunner(t),i.frameCount%5==0&&i.collisionTest(),i.runwayLength-=i.bgSpeed,i.runwayLength+i.runner.size[1]<=0?(i.endRun(),!1):void(i.rafId=window.requestAnimationFrame(e))}var i=this;i.swipeLock=!1,e()},endRun:function(){for(var t=0;t<timerArray.length;t++)clearInterval(timerArray[t]);window.cancelAnimationFrame(this.rafId),this.swipeLock=!0;var e=this.runwayLength+this.runner.size[1]<0?0:this.runwayLength+this.runner.size[1];if(vm.baseScore=Math.floor(80*(1-e/(this.totalDistance+this.runner.size[1]))),e<=0){var i=Math.ceil(parseFloat(vm.costSeconds));vm.timeScore=20-(i>25?i-25:0)}vm.totalGameScore=vm.baseScore+vm.curIntegral+vm.timeScore,vm.totalIntegral+=vm.totalGameScore,_gameover()}};