From 74c0df432fd556213710e0bd08825cb1b0a1fdd2 Mon Sep 17 00:00:00 2001 From: sunzhenyu Date: Tue, 12 Nov 2019 19:02:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=89=E7=BB=B4=E8=A1=8C?= =?UTF-8?q?=E8=BD=A6=E4=BD=8D=E7=BD=AE=E5=8F=91=E9=80=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jl3ddrive/moveupdate/DrivingConnect.js | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnect.js b/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnect.js index d4947b611..7febd96ef 100644 --- a/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnect.js +++ b/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnect.js @@ -205,18 +205,26 @@ export function Jl3dDriving(updatemmi,sound,translation) { percent: 0 }; if (trainlisttest.list[code].status == '02') { - if((trainlisttest.list[code].linkOffsetPercent/trainlisttest.list[code].pc)>=trainlisttest.list[code].targetpercent){ + if(trainlisttest.list[code].targetLink == trainlisttest.list[code].nowcode){ + if((trainlisttest.list[code].linkOffsetPercent/trainlisttest.list[code].pc)>=trainlisttest.list[code].targetpercent){ + syncdata.percent = trainlisttest.list[code].progress; + }else{ + syncdata.percent = trainlisttest.list[code].progress*trainlisttest.list[code].pc; + } + }else{ syncdata.percent = trainlisttest.list[code].progress; - }else{ - syncdata.percent = trainlisttest.list[code].progress*trainlisttest.list[code].pc; - } - } else { - if(trainlisttest.list[code].progress<=trainlisttest.list[code].targetpercent){ - syncdata.percent = (1 - trainlisttest.list[code].progress); - }else{ - syncdata.percent = (1 - trainlisttest.list[code].progress)*trainlisttest.list[code].pc; } + } else { + if(trainlisttest.list[code].targetLink == trainlisttest.list[code].nowcode){ + if(trainlisttest.list[code].progress<=trainlisttest.list[code].targetpercent){ + syncdata.percent = (1 - trainlisttest.list[code].progress); + }else{ + syncdata.percent = (1 - trainlisttest.list[code].progress)*trainlisttest.list[code].pc; + } + }else{ + syncdata.percent = (1 - trainlisttest.list[code].progress); + } } // console.log(syncdata); @@ -348,6 +356,7 @@ export function Jl3dDriving(updatemmi,sound,translation) { trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent; trainlisttest.list[code].progress = data.body[i].linkOffsetPercent/trainlisttest.list[code].pc; trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; + trainlisttest.list[code].targetLink = data.body[i].targetLink; }else{ trainlisttest.list[code].progress = data.body[i].linkOffsetPercent; trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; @@ -375,6 +384,7 @@ export function Jl3dDriving(updatemmi,sound,translation) { trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent; trainlisttest.list[code].progress = (1-data.body[i].linkOffsetPercent)/trainlisttest.list[code].pc; trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; + trainlisttest.list[code].targetLink = data.body[i].targetLink; }else{ trainlisttest.list[code].progress = 1-data.body[i].linkOffsetPercent; trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; @@ -508,19 +518,19 @@ export function Jl3dDriving(updatemmi,sound,translation) { // console.log(rails.linkrail[nextcode].lineleft.points); let nextcode; if(code == drivingcode){ - // console.log(data.body[i].targetStation); - // console.log("netpercent"); - // console.log(data.body[i].targetLinkPercent); - // console.log(data.body[i].linkOffsetPercent); - // console.log("3dpercent"); - // if(rails.stops[data.body[i].targetStation]){ - // console.log(rails.stops[data.body[i].targetStation].direct2.percent); - // } - // - // console.log(trainlisttest.list[code].progress); - // console.log(trainlisttest.list[code].pc); - // console.log("==============="); - // console.log(data.body[i]); + console.log(data.body[i].targetStation); + console.log("netpercent"); + console.log(data.body[i].targetLinkPercent); + console.log(data.body[i].linkOffsetPercent); + console.log("3dpercent"); + if(rails.stops[data.body[i].targetStation]){ + console.log(rails.stops[data.body[i].targetStation].direct2.percent); + } + + console.log(trainlisttest.list[code].progress); + console.log(trainlisttest.list[code].pc); + console.log("==============="); + console.log(data.body[i]); if(data.body[i].directionType == '02'){ if(trainlisttest.list[code].stopstation != data.body[i].targetStation){ trainlisttest.list[code].stopstation = data.body[i].targetStation; @@ -528,6 +538,7 @@ export function Jl3dDriving(updatemmi,sound,translation) { trainlisttest.list[code].pc = data.body[i].targetLinkPercent/rails.stops[data.body[i].targetStation].direct2.percent; trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent; trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; + trainlisttest.list[code].targetLink = data.body[i].targetLink; } } @@ -549,6 +560,7 @@ export function Jl3dDriving(updatemmi,sound,translation) { trainlisttest.list[code].pc = data.body[i].targetLinkPercent/rails.stops[data.body[i].targetStation].direct1.percent; trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent; trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent; + trainlisttest.list[code].targetLink = data.body[i].targetLink; } } trainlisttest.list[code].status = '03';