修复三维车站客流上车人数无限制bug

This commit is contained in:
sunzhenyu 2020-12-29 16:07:07 +08:00
parent f45262c245
commit 447a255a35
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(toptrain.nowcode == data.body.code && topswitch == true){
console.log(data);
//根据上下车人数创建人
jl3d.updateNowLeaveData("top",data.body.out);
setTimeout(function(){
passerAi.passerout("top","start")
passerAi.passerout("top","start",data.body.in)
}, 5000);
}
@ -96,7 +96,7 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
//根据上下车人数创建人
jl3d.updateNowLeaveData("down",data.body.out);
setTimeout(function(){
passerAi.passerout("down","start");
passerAi.passerout("down","start",data.body.in);
}, 5000);
}
}
@ -154,8 +154,9 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
}
}
if(downtrain.nowcode == data.body.code){
// console.log(data.body);
if(data.body.open == "0"){
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();
});
}
}
let actions;
function opentraindoor(train,doorcode,direct){

View File

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

View File

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

View File

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