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';