This commit is contained in:
fan 2020-12-29 16:13:44 +08:00
commit 0ea5ba18ab
4 changed files with 50 additions and 29 deletions

View File

@ -84,11 +84,11 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
if(data.type == "TRAIN_PFI_BL"){ if(data.type == "TRAIN_PFI_BL"){
if(toptrain.nowcode == data.body.code && topswitch == true){ if(toptrain.nowcode == data.body.code && topswitch == true){
console.log(data);
//根据上下车人数创建人 //根据上下车人数创建人
jl3d.updateNowLeaveData("top",data.body.out); jl3d.updateNowLeaveData("top",data.body.out);
setTimeout(function(){ setTimeout(function(){
passerAi.passerout("top","start") passerAi.passerout("top","start",data.body.in)
}, 5000); }, 5000);
} }
@ -96,7 +96,7 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
//根据上下车人数创建人 //根据上下车人数创建人
jl3d.updateNowLeaveData("down",data.body.out); jl3d.updateNowLeaveData("down",data.body.out);
setTimeout(function(){ setTimeout(function(){
passerAi.passerout("down","start"); passerAi.passerout("down","start",data.body.in);
}, 5000); }, 5000);
} }
} }
@ -154,8 +154,9 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
} }
} }
if(downtrain.nowcode == data.body.code){ if(downtrain.nowcode == data.body.code){
// console.log(data.body);
if(data.body.open == "0"){ if(data.body.open == "0"){
closetraindoor(downtrain,data.body.doorCode,"down"); closetraindoor(downtrain,data.body.doorCode,"down");
@ -165,6 +166,7 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
} }
} }
} }
} }
@ -217,7 +219,9 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
location.reload(); location.reload();
}); });
} }
} }
let actions; let actions;
function opentraindoor(train,doorcode,direct){ function opentraindoor(train,doorcode,direct){

View File

@ -261,6 +261,8 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap,initCode) {
//下车控制开关 //下车控制开关
passerAi.toppasseron = false; passerAi.toppasseron = false;
passerAi.downpasseron = false; passerAi.downpasseron = false;
passerAi.toppasserinNum = 0;
passerAi.downpasserinNum = 0;
passerTrain.toptrain.nowcode = null; passerTrain.toptrain.nowcode = null;
passerTrain.downtrain.nowcode = null; passerTrain.downtrain.nowcode = null;

View File

@ -8,7 +8,9 @@ export function PasserAi(zone,finder) {
this.downpasseron = false; this.downpasseron = false;
//上车控制开关 //上车控制开关
this.toppasserin = false; this.toppasserin = false;
this.toppasserinNum = 0;
this.downpasserin = false; this.downpasserin = false;
this.downpasserinNum = 0;
let passerZone = zone; let passerZone = zone;
let pathFinder = finder; let pathFinder = finder;
@ -16,18 +18,24 @@ export function PasserAi(zone,finder) {
let playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 ); let playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 );
let targetPosition = new THREE.Vector3(); let targetPosition = new THREE.Vector3();
//生成下车出站人物 //生成下车出站人物
this.passerout = function(direct,mode){ this.passerout = function(direct,mode,inNum){
// console.log(direct);
if(direct == "top"){ if(direct == "top"){
// console.log("toppasser"); // console.log("toppasser");
if(mode == "start"){ if(mode == "start"){
scope.toppasseron = true; scope.toppasseron = true;
scope.toppasserin = true; scope.toppasserin = true;
scope.toppasserinNum = inNum;
} }
if(mode == "end"){ if(mode == "end"){
scope.toppasseron = false scope.toppasseron = false
scope.toppasserin = false; scope.toppasserin = false;
} }
// scope.toppasseron = true; // scope.toppasseron = true;
// setTimeout(function(){ // setTimeout(function(){
// scope.toppasseron = false // scope.toppasseron = false
@ -42,6 +50,7 @@ export function PasserAi(zone,finder) {
if(mode == "start"){ if(mode == "start"){
scope.downpasseron = true; scope.downpasseron = true;
scope.downpasserin = true; scope.downpasserin = true;
scope.downpasserinNum = inNum;
} }
if(mode == "end"){ if(mode == "end"){
scope.downpasseron = false; scope.downpasseron = false;
@ -133,46 +142,54 @@ export function PasserAi(zone,finder) {
} }
for(let i=0;i<topWaitPassers.children.length;i++){ for(let i=0;i<topWaitPassers.children.length;i++){
if(topWaitPassers.children[i].status == 0){ if(scope.toppasserinNum >0){
//stage = 4 上车 if(topWaitPassers.children[i].status == 0){
if(topWaitPassers.children[i].stage == 4){ //stage = 4 上车
if(scope.toppasserin && topWaitPassers.children[i].direct == "top"){ if(topWaitPassers.children[i].stage == 4){
if(scope.toppasserin && topWaitPassers.children[i].direct == "top"){
let points = []; let points = [];
points.push(new THREE.Vector3(topWaitPassers.children[i].position.x,topWaitPassers.children[i].position.y,topWaitPassers.children[i].position.z)); points.push(new THREE.Vector3(topWaitPassers.children[i].position.x,topWaitPassers.children[i].position.y,topWaitPassers.children[i].position.z));
points.push(passerZone.list["standtop"].doorpoints[topWaitPassers.children[i].door]); points.push(passerZone.list["standtop"].doorpoints[topWaitPassers.children[i].door]);
if(points[1] == undefined){ if(points[1] == undefined){
}else{ }else{
passerHuman.initMoveAnimate(topWaitPassers.children[i],i,points,i);
scope.toppasserinNum -= 1;
passerHuman.initMoveAnimate(topWaitPassers.children[i],i,points,i);
}
} }
} }
} }
} }
} }
for(let i=0;i<downWaitPassers.children.length;i++){ for(let i=0;i<downWaitPassers.children.length;i++){
if(downWaitPassers.children[i].status == 0){ if(scope.downpasserinNum >0){
//stage = 4 上车 if(downWaitPassers.children[i].status == 0){
if(downWaitPassers.children[i].stage == 4){ //stage = 4 上车
if(downWaitPassers.children[i].stage == 4){
if(scope.downpasserin && downWaitPassers.children[i].direct == "down"){ if(scope.downpasserin && downWaitPassers.children[i].direct == "down"){
let points = []; let points = [];
points.push(new THREE.Vector3(downWaitPassers.children[i].position.x,downWaitPassers.children[i].position.y,downWaitPassers.children[i].position.z)); points.push(new THREE.Vector3(downWaitPassers.children[i].position.x,downWaitPassers.children[i].position.y,downWaitPassers.children[i].position.z));
points.push(passerZone.list["standdown"].doorpoints[downWaitPassers.children[i].door]); points.push(passerZone.list["standdown"].doorpoints[downWaitPassers.children[i].door]);
if(points[1] == undefined){ if(points[1] == undefined){
}else{ }else{
passerHuman.initMoveAnimate(downWaitPassers.children[i],i,points,i); scope.downpasserinNum -= 1;
passerHuman.initMoveAnimate(downWaitPassers.children[i],i,points,i);
}
} }
} }
} }
} }
} }
for(let i=0;i<humanlist.children.length;i++){ for(let i=0;i<humanlist.children.length;i++){

View File

@ -16,13 +16,11 @@ function timedCount(){
// console.log(e.data); // console.log(e.data);
if(e.data[0] == "changespeed"){ if(e.data[0] == "changespeed"){
if(update){ if(update){
console.log(e.data[1]);
clearInterval(update); clearInterval(update);
if(e.data[1] == 0){ if(e.data[1] == 0){
}else{ }else{
let speed = 900/e.data[1]; let speed = 900/e.data[1];
console.log(speed);
update = setInterval("stationupdate()", speed); update = setInterval("stationupdate()", speed);
} }