This commit is contained in:
zyy 2020-06-01 13:36:41 +08:00
commit 3e62782fc3
21 changed files with 500 additions and 418 deletions

File diff suppressed because one or more lines are too long

View File

@ -154,6 +154,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
let assetsdata = JSON.parse(netdata.data.sections);
if(assetsdata.link){
scope.datatype = "old";
// datanew();
// scope.jsonwebwork = new Worker("../../static/workertest/jsonworker.js");
// scope.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
// scope.Subscribe.socketon(scope.Subscribe.topic);
@ -165,7 +166,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
if(trainlisttest){
if(trainlisttest.group){
if(trainlisttest.group.children[0]){
console.log(trainlisttest.group.children[0].name);
// console.log(trainlisttest.group.children[0].name);
updatemmi.updatedrivingcode(trainlisttest.group.children[0].name);
scope.Subscribe.initdrivercode(trainlisttest.group.children[0].name);
for(let k in rails.switchrail){

View File

@ -100,6 +100,7 @@ export function Jl3dDriving(mixers, updatemmi, sound, translation, routegroup) {
//
// }
// console.log(data);
// console.log(data);
switch (data.type) {
case 'Simulation_Driver_Change':
@ -113,6 +114,7 @@ export function Jl3dDriving(mixers, updatemmi, sound, translation, routegroup) {
updatemmi.updatedrivingcode( data.body.code);
break;
case 'Simulation_TrainSpeed':
trainspeed(data);
break;
case 'SJL3D_TrainStatus':

View File

@ -98,6 +98,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
// console.log(data);
if(data.type == "Train_Position"){
// stats.update();
trainrun(data.body);
return;
}

View File

@ -48,6 +48,22 @@ var Staticmodel = {
picUrl: "",
assetUrl: "../../static/model/passflow/monitor.FBX"
},
train: {
id: "7",
name: "列车",
deviceType: "train",
type: "hrb",
picUrl: "",
assetUrl: "../../static/model/train/train.FBX"
},
section: {
id: "8",
name: "区段",
deviceType: "section",
type: "hrb",
picUrl: "",
assetUrl: "../../static/model/passflow/section.FBX"
},
}

View File

@ -38,7 +38,6 @@ let originhuman1 = null;
let originhuman2 = null;
let originanima1 = null;
let originanima2 = null;
let moveanimatelist = [];
let zhajiin = [];
let zhajiout = [];
@ -218,10 +217,6 @@ export function Jl3dpassflow(dom) {
this.selectmodel = null;
const Color = {
GROUND: new THREE.Color( 0x606060 ).convertGammaToLinear( 2.2 ).getHex(),
NAVMESH: new THREE.Color( 0xFFFFFF ).convertGammaToLinear( 2.2 ).getHex(),
};
const ZONE = 'level';
const SPEED = 10;
@ -233,12 +228,12 @@ export function Jl3dpassflow(dom) {
let groupID, path;
const playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 );
const targetPosition = new THREE.Vector3();
let playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 );
let targetPosition = new THREE.Vector3();
const pathfinder = new THREE.Pathfinding();
const mouse = new THREE.Vector2();
const raycaster = new THREE.Raycaster();
let pathfinder = new THREE.Pathfinding();
let mouse = new THREE.Vector2();
let raycaster = new THREE.Raycaster();
var loader = new THREE.OBJLoader();
@ -250,9 +245,9 @@ export function Jl3dpassflow(dom) {
function ( object ) {
console.time('createZone()');
// console.time('createZone()');
const zone = THREE.Pathfinding.createZone(object.children[0].geometry);
console.timeEnd('createZone()');
// console.timeEnd('createZone()');
pathfinder.setZoneData( ZONE, zone );
@ -301,7 +296,6 @@ export function Jl3dpassflow(dom) {
console.log(intersects[0].point);
targetPosition.copy( intersects[0].point );
originhuman1.position.copy( playerPosition );
// Teleport on ctrl/cmd click or RMB.
if (event.metaKey || event.ctrlKey || event.button === 2) {
@ -320,28 +314,14 @@ export function Jl3dpassflow(dom) {
points.push(path[i]);
}
originhuman1.curve = new THREE.CatmullRomCurve3(points);
originhuman1.curve.curvrtype = "chordal";
originhuman1.curve.curvrtype = "centripetal";
originhuman1.progress = 0;
console.log(path);
}
function tick ( dt ) {
// if ( !level || !(path||[]).length ) return
//
// let targetPosition = path[ 0 ];
// const velocity = targetPosition.clone().sub( playerPosition );
//
// if (velocity.lengthSq() > 0.05 * 0.05) {
// velocity.normalize();
// // Move player to target
// playerPosition.add( velocity.multiplyScalar( dt * SPEED ) );
// // originhuman1.lookAt();
// originhuman1.position.copy( playerPosition );
// } else {
// // Remove node from the path we calculated
// path.shift();
// }
if(originhuman1.curve){
if(originhuman1.progress<1){
let point = originhuman1.curve.getPointAt(originhuman1.progress);
@ -383,7 +363,8 @@ export function Jl3dpassflow(dom) {
initstationanimation(scope.modelmanager.station.mesh);
initzhajiinaimation(scope.modelmanager.zhajiin.mesh);
initzhajioutanimation(scope.modelmanager.zhajiout.mesh);
scene.add(scope.modelmanager.section.mesh);
scene.add(scope.modelmanager.train.mesh);
level = scope.modelmanager.station.mesh;
monitor = scope.modelmanager.monitor.mesh;
@ -415,45 +396,6 @@ export function Jl3dpassflow(dom) {
scene.add(humanlist);
scene.add(scope.modelmanager.man1.mesh);
for(let i=0;i<200;i++){
var mantype = Math.floor(Math.random()*(3-1+1))+1;
let newhuman;
if(mantype == 1){
newhuman = THREE.SkeletonUtils.clone( originhuman1 );
newhuman.animations = [];
newhuman.animations.push(originanima1.clone());
}else{
newhuman = THREE.SkeletonUtils.clone( originhuman2 );
newhuman.animations = [];
newhuman.animations.push(originanima2.clone());
}
// zhajiin[j].waiting = 1;
let mixer = new THREE.AnimationMixer( newhuman );
mixer.runplay = false;
let action = mixer.clipAction( newhuman.animations[ 0 ] );
newhuman.status = 1;
newhuman.stage = 0;
let newone = {
id:i,
mesh:newhuman,
direct:null,
doorstatus:null,
doors:null,
action:action,
mixer:mixer,
runrail:null
};
humans.push(newone);
mixers.push(mixer);
humanlist.add(newhuman);
}
}
@ -466,8 +408,8 @@ export function Jl3dpassflow(dom) {
clearInterval(checkobject);
//进站控制
startWorker();
// stationwebwork.postMessage("on");
// passerwebwork.postMessage("on");
stationwebwork.postMessage("on");
passerwebwork.postMessage("on");
};
},1000);
@ -488,123 +430,40 @@ export function Jl3dpassflow(dom) {
}
}
function initpasser(){
for(let i=0;i<3;i++){
newhumancreate(stationzon.getinitposition("enter1"),0);
}
for(let i=0;i<3;i++){
newhumancreate(stationzon.getinitposition("enter2"),0);
}
for(let i=0;i<3;i++){
newhumancreate(stationzon.getinitposition("security"),1);
}
for(let i=0;i<2;i++){
newhumancreate(stationzon.getinitposition("entergate"),2);
}
for(let i=0;i<6;i++){
newhumancreate(stationzon.getinitposition("standtop"),3);
}
for(let i=0;i<6;i++){
newhumancreate(stationzon.getinitposition("standdown"),3);
}
for(let i=0;i<5;i++){
newhumancreate(stationzon.getinitposition("exitgate"),4);
}
console.log(humanlist);
}
function startWorker(){
initpasser();
passerwebwork.onmessage = function (event) {
if(humans){
// console.log(humans.length);
// console.log(humans.length);
for(let i=0;i<humans.length;i++){
// console.log(humans[i]);
if(humans[i].status == 0){
if(humans[i].stage == 1){
let points = [];
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z-5));
zhajicontrol("in",humans[i].doors);
moveanimateinit(humans[i],i,points,i,0.02);
}
if(humans[i].stage == 2){
let points = [];
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
points.push(new THREE.Vector3(12,10,12.9));
points.push(new THREE.Vector3(28,1.7,12.9));
points.push(new THREE.Vector3(34,1.7,12.9));
//1--left
//2-- right
if(humans[i].direct == 1){
points.push(new THREE.Vector3(34,1.7,16));
for(let j =0;j<22;j++){
if(stationleft[j].waiting == 0){
points.push(new THREE.Vector3(51-j*5,1.7,22));
points.push(new THREE.Vector3(51-j*5,1.7,23));
humans[i].doors = j;
stationright[j].waiting = 1;
moveanimateinit(humans[i],i,points,i,0.002);
j =22;
}
}
}else{
points.push(new THREE.Vector3(34,1.7,16));
points.push(new THREE.Vector3(14,1.7,17));
points.push(new THREE.Vector3(14,1.7,3));
for(let j =0;j<22;j++){
if(stationright[j].waiting == 0){
points.push(new THREE.Vector3(51-j*5,1.7,3));
points.push(new THREE.Vector3(51-j*5,1.7,2));
humans[i].doors = j;
stationright[j].waiting = 1;
moveanimateinit(humans[i],i,points,i,0.002);
j =22;
}
}
}
moveanimateinit(humans[i],i,points,i,0.002);
}
//出站
if(humans[i].stage == 3){
let points = [];
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
if(humans[i].doors<11){
if(humans[i].direct == 1){
points.push(new THREE.Vector3(10,1.7,17));
}else{
points.push(new THREE.Vector3(8,1.7,5));
}
points.push(new THREE.Vector3(8,1.7,13));
points.push(new THREE.Vector3(5,1.7,13));
points.push(new THREE.Vector3(-4,6,13));
}else{
if(humans[i].direct == 1){
points.push(new THREE.Vector3(-19,1.7,17));
}else{
points.push(new THREE.Vector3(-18,1.7,6.4));
}
points.push(new THREE.Vector3(-18,1.7,13));
points.push(new THREE.Vector3(-12,1.7,13));
points.push(new THREE.Vector3(-7,6.8,12));
}
points.push(new THREE.Vector3(-5,10,4));
points.push(new THREE.Vector3(14,10,3));
var j = Math.floor(Math.random()*(4-1+1))+1;
points.push(new THREE.Vector3(19,10,-2+j*1.4));
humans[i].doors = j;
moveanimateinit(humans[i],i,points,i,0.002);
}
if(humans[i].stage == 4){
let points = [];
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
points.push(new THREE.Vector3(humans[i].mesh.position.x+4,humans[i].mesh.position.y,humans[i].mesh.position.z));
if(humans[i].direct == 1){
points.push(new THREE.Vector3(33,10,25));
}else{
points.push(new THREE.Vector3(33.5,10,-5));
}
zhajicontrol("out",humans[i].doors);
moveanimateinit(humans[i],i,points,i,0.002);
}
}
}
}
moveanimateupdate();
// delta = clock.getDelta();
// tick(delta);
passerai();
if(mixers[i]._actions[0].isRunning()){
mixers[i].update( delta );
}
delta = clock.getDelta();
// tick(delta);
for(let i=mixers.length-1;i>=0;i--){
if(mixers[i]._actions[0].isRunning()){
@ -615,9 +474,17 @@ export function Jl3dpassflow(dom) {
};
stationwebwork.onmessage = function (event) {
// console.log("stationwebwork");
if(humans.length<200){
newhumancreate();
// if(humans.length<200){
var direct = Math.floor(Math.random()*(3-1+1))+1;
//1--top
//2-- down
if(direct == 1){
newhumancreate(stationzon.getzoneposition("enter1"),0);
}else{
newhumancreate(stationzon.getzoneposition("enter2"),0);
}
// }
};
}
@ -632,125 +499,257 @@ export function Jl3dpassflow(dom) {
monitorrender();
}
delta = clock.getDelta();
tick(delta);
// delta = clock.getDelta();
// tick(delta);
requestAnimationFrame(animate);
}
function moveanimateinit(model,name,points,index,speed){
function passerai(){
for(let i=0;i<humanlist.children.length;i++){
// console.log(humans[i]);
if(humanlist.children[i].status == 0){
if(humanlist.children[i].stage == 0){
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("security");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
// console.log(path);
}
if(humanlist.children[i].stage == 1){
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("entergate");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
}
if(humanlist.children[i].stage == 2){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z-5));
// zhajicontrol("in",humans[i].doors);
moveanimateinit(humanlist.children[i],i,points,i);
}
if(humanlist.children[i].stage == 3){
var direct = Math.floor(Math.random()*(3-1+1))+1;
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
//1--top
//2-- down
if(direct == 1){
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("standtop");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
}else{
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("standdown");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
}
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
}
// //出站
// if(humanlist.children[i].stage == 3){
// // let points = [];
// // points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
// // if(humans[i].doors<11){
// // if(humans[i].direct == 1){
// // points.push(new THREE.Vector3(10,1.7,17));
// // }else{
// // points.push(new THREE.Vector3(8,1.7,5));
// // }
// // points.push(new THREE.Vector3(8,1.7,13));
// // points.push(new THREE.Vector3(5,1.7,13));
// // points.push(new THREE.Vector3(-4,6,13));
// // }else{
// // if(humans[i].direct == 1){
// // points.push(new THREE.Vector3(-19,1.7,17));
// // }else{
// // points.push(new THREE.Vector3(-18,1.7,6.4));
// // }
// // points.push(new THREE.Vector3(-18,1.7,13));
// // points.push(new THREE.Vector3(-12,1.7,13));
// // points.push(new THREE.Vector3(-7,6.8,12));
// // }
// // points.push(new THREE.Vector3(-5,10,4));
// // points.push(new THREE.Vector3(14,10,3));
// // var j = Math.floor(Math.random()*(4-1+1))+1;
// // points.push(new THREE.Vector3(19,10,-2+j*1.4));
// //
// // humans[i].doors = j;
// // moveanimateinit(humans[i],i,points,i,0.002);
// }
if(humanlist.children[i].stage == 4){
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("exitgate");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
}
if(humanlist.children[i].stage == 5){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
points.push(new THREE.Vector3(humanlist.children[i].position.x+5,humanlist.children[i].position.y,humanlist.children[i].position.z));
// zhajicontrol("in",humans[i].doors);
moveanimateinit(humanlist.children[i],i,points,i);
}
if(humanlist.children[i].stage == 6){
var direct = Math.floor(Math.random()*(3-1+1))+1;
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
//1--top
//2-- down
if(direct == 1){
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("exit1");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
}else{
groupID = pathfinder.getGroup( ZONE, humanlist.children[i].position );
targetPosition = stationzon.getzoneposition("exit2");
path = pathfinder.findPath( humanlist.children[i].position, targetPosition, ZONE, groupID );
}
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
}
}
}
}
function moveanimateinit(model,name,points,index){
model.status = 1;
let curve = new THREE.CatmullRomCurve3(points);
curve.curvrtype = "chordal";
curve.curvrtype = "centripetal";
// curve.getLength();
// curve动画轨迹
// progress动画进度
// enable当前动画开关
// speed动画速度
// console.log(curve);
let animate = {
name:index,
index:index,
curve:curve,
progress:0,
directchange:false,
enable:true,
status:"start",
speed:speed,
};
humans[index].runrail = animate;
humans[index].status = 1;
humans[index].action.play();
humans[index].mixer.runplay = true;
moveanimatelist.push(animate);
model.action.play();
model.progress = 0;
model.runrail = curve;
model.speed = 0.1/curve.getLength();
}
function moveanimateupdate(){
if(humans.length>0){
for(let i=0;i<humans.length;i++){
if(humans[i].runrail.enable){
// 动画播放结束
if(humans[i].runrail.progress>=1){
for(let i=0;i<humanlist.children.length;i++){
if(humanlist.children[i].status == 1){
if(humanlist.children[i].progress>=1){
// let point = humans[i].runrail.curve.getPointAt(1);
//更新模型坐标
// console.log(moveanimatelist);
if(humans[i].status == 1){
humans[i].runrail.enable = false;
humans[i].runrail.progress = 1;
humans[i].mixer.runplay = false;
humans[i].action.stop();
humans[i].status = 0;
if(humanlist.children[i].status == 1){
// humanlist.children[i].runrail.enable = false;
humanlist.children[i].progress = 1;
// humanlist.children[i].mixer.runplay = false;
humanlist.children[i].action.stop();
humanlist.children[i].status = 0;
if(humans[i].stage == 4){
humanlist.remove(humans[i].mesh);
// humans.splice(i,1);
}
if(humans[i].stage == 3){
if(humans[i].direct == 1){
stationleft[humans[i].doors].waiting = 0;
}else{
stationright[humans[i].doors].waiting = 0;
}
humans[i].stage = 4;
// if(humanlist.children[i].stage == 4){
//
// humanlist.remove(humanlist.children[i].mesh);
// // humans.splice(i,1);
// }
//
if(humanlist.children[i].stage == 6){
humanlist.remove(humanlist.children[i]);
// humanlist.children[i].stage = 7;
}
if(humans[i].stage == 2){
humans[i].stage = 3;
if(humanlist.children[i].stage == 5){
humanlist.children[i].stage = 6;
}
if(humanlist.children[i].stage == 4){
humanlist.children[i].stage = 5;
}
if(humanlist.children[i].stage == 3){
humanlist.children[i].stage = 4;
}
//
if(humanlist.children[i].stage == 2){
humanlist.children[i].stage = 3;
}
if(humans[i].stage == 1){
if(humanlist.children[i].stage == 1){
humans[i].stage = 2;
humanlist.children[i].stage = 2;
}
if(humans[i].stage == 0){
// console.log(humans[i].doors);
zhajiin[humans[i].doors].waiting = 0;
humans[i].stage = 1;
if(humanlist.children[i].stage == 0){
// // console.log(humans[i].doors);
// zhajiin[humanlist.children[i].doors].waiting = 0;
humanlist.children[i].stage = 1;
}
moveanimatelist.splice(i,1);
}
}else{
//根据动画进度获取动画轨迹上点
let point = humans[i].runrail.curve.getPointAt(humans[i].runrail.progress);
// console.log(i);
// console.log(humanlist.children[i].runrail);
// console.log(humanlist.children[i].progress);
let point = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress);
//更新模型坐标
humans[i].mesh.position.x = point.x;
humans[i].mesh.position.y = point.y;
humans[i].mesh.position.z = point.z;
if((humans[i].runrail.progress+0.001)<1){
let tangent = humans[i].runrail.curve.getPointAt(humans[i].runrail.progress+0.001);
humans[i].mesh.lookAt(new THREE.Vector3(tangent.x,humans[i].mesh.position.y,tangent.z));
humanlist.children[i].position.x = point.x;
humanlist.children[i].position.y = point.y;
humanlist.children[i].position.z = point.z;
if((humanlist.children[i].progress+0.001)<1){
let tangent = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress+0.001);
humanlist.children[i].lookAt(new THREE.Vector3(tangent.x,humanlist.children[i].position.y,tangent.z));
}
humans[i].runrail.progress += humans[i].runrail.speed;
humanlist.children[i].progress += humanlist.children[i].speed;
point = null;
}
}
}
}
}
function newhumancreate(){
var direct = Math.floor(Math.random()*(3-1+1))+1;
function newhumancreate(position,stage,){
var mantype = Math.floor(Math.random()*(3-1+1))+1;
// console.log(direct);
let points = [];
let newhuman;
if(mantype == 1){
newhuman = THREE.SkeletonUtils.clone( originhuman1 );
@ -762,51 +761,21 @@ export function Jl3dpassflow(dom) {
newhuman.animations.push(originanima2.clone());
}
if(direct == 1|| direct == 2){
let testposition = stationzon.getzoneposition("enter1");
newhuman.position.set(32,10,25);
points.push(testposition);
points.push(new THREE.Vector3(26,10,21));
points.push(new THREE.Vector3(18,10,18));
}else{
let testposition = stationzon.getzoneposition("enter2");
newhuman.position.set(32,10,-5);
points.push(testposition);
points.push(new THREE.Vector3(26,10,12));
points.push(new THREE.Vector3(24,10,17));
points.push(new THREE.Vector3(18,10,18));
}
let j = Math.floor(Math.random()*(4-1+1))+1;
points.push(new THREE.Vector3(-0.5+j*1.4,10,18.5));
// zhajiin[j].waiting = 1;
let mixer = new THREE.AnimationMixer( newhuman );
mixer.runplay = false;
let action = mixer.clipAction( newhuman.animations[ 0 ] );
newhuman.position.copy(position);
newhuman.status = 0;
var stationdirection = Math.floor(Math.random()*(2-1+1))+1;
let newone = {
id:humans.length,
mesh:newhuman,
status:1,
stage:0,
direct:stationdirection,
doorstatus:null,
doors:j,
action:action,
mixer:mixer,
runrail:null
};
humans.push(newone);
newhuman.stage = stage;
newhuman.direct = null;
newhuman.doorstatus = null;
newhuman.doors = null;
newhuman.action = mixer.clipAction( newhuman.animations[ 0 ] );
newhuman.mixer = mixer;
newhuman.runrail = null;
newhuman.speed = 0;
mixers.push(mixer);
humanlist.add(newhuman);
moveanimateinit(newone,humans.length,points,newone.id,0.002);
// return newone;
}
function initstationanimation(object){

View File

@ -44,6 +44,22 @@ export function ModelManager(){
action:null
};
this.train = {
code:null,
screenDoorOpenStatus:"01",
mesh:null,
action:null
};
this.section = {
code:null,
screenDoorOpenStatus:"01",
mesh:null,
action:null
};
this.loadpromise = function (data,mixers){
let initlist = [];
initlist.push(fbxpromise(data.man1,mixers,scope.man1));
@ -52,6 +68,8 @@ export function ModelManager(){
initlist.push(fbxpromise(data.zhajiin,mixers,scope.zhajiin));
initlist.push(fbxpromise(data.zhajiout,mixers,scope.zhajiout));
initlist.push(fbxpromise(data.monitor,mixers,scope.monitor));
initlist.push(fbxpromise(data.train,mixers,scope.train));
initlist.push(fbxpromise(data.section,mixers,scope.section));
return new Promise(function(resolve, reject){

View File

@ -5,6 +5,7 @@ let enter1 = {
name : "enter1",
type : "normal",
stage : "0",
randompoint : new THREE.Vector3(26.6,9.8,-2.7),
railpoints : [
new THREE.Vector3(34,9.8,-6),
new THREE.Vector3(32,9.8,-6)
@ -16,6 +17,7 @@ let enter2 = {
name : "enter2",
type : "normal",
stage : "0",
randompoint : new THREE.Vector3(27,9.8,16),
railpoints : [
new THREE.Vector3(35,9.8,31.5),
new THREE.Vector3(31,9.8,31.5)
@ -27,6 +29,7 @@ let security = {
name : "security",
type : "device",
stage : "1",
randompoint : new THREE.Vector3(8.8,9.8,18),
railpoints : [
new THREE.Vector3(20.5,9.8,18),
new THREE.Vector3(21,9.8,21)
@ -38,6 +41,7 @@ let entergate = {
name : "entergate",
type : "device",
stage : "2",
randompoint : new THREE.Vector3(2.3,9.8,13),
railpoints : [
new THREE.Vector3(6.3,9.8,17.4),
new THREE.Vector3(4.8,9.8,17.4),
@ -52,6 +56,7 @@ let standtop = {
name : "standtop",
type : "stand",
stage : "3",
randompoint : new THREE.Vector3(-64,1.77,0.38),
railpoints : [
new THREE.Vector3(52.1,1.77,-1.8),
new THREE.Vector3(-63.5,1.77,-1.8)
@ -63,6 +68,7 @@ let standdown = {
name : "standdown",
type : "stand",
stage : "3",
randompoint : new THREE.Vector3(-64,1.77,21),
railpoints : [
new THREE.Vector3(52.1,1.77,24),
new THREE.Vector3(-64,1.77,24)
@ -74,6 +80,7 @@ let exitgate = {
name : "exitgate",
type : "device",
stage : "5",
randompoint : new THREE.Vector3(-16,9.8,-0.4),
railpoints : [
new THREE.Vector3(18.8,9.8,-0.27),
new THREE.Vector3(18.8,9.8,1.18),
@ -88,6 +95,7 @@ let exit1 = {
name : "exit1",
type : "normal",
stage : "6",
randompoint : new THREE.Vector3(),
railpoints : [
new THREE.Vector3(28.2,9.8,-7),
new THREE.Vector3(30.5,9.8,-7.4)
@ -99,6 +107,7 @@ let exit2 = {
name : "exit2",
type : "normal",
stage : "6",
randompoint : new THREE.Vector3(),
railpoints : [
new THREE.Vector3(28.3,9.8,28.8),
new THREE.Vector3(31.2,9.8,28.8)
@ -127,6 +136,44 @@ export function ZoneManager() {
scope.list[exit2.name] = new ZoneModel(exit2);
}
this.getinitposition = function(name){
// console.log(scope.list[name]);
let randompoint = new THREE.Vector3(0,scope.list[name].randompoint.y,0);
// console.log(randompoint);
if(name == "enter1"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*8;
randompoint.z = scope.list[name].randompoint.z + Math.random()*8;
}
if(name == "enter2"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*8;
randompoint.z = scope.list[name].randompoint.z + Math.random()*8;
}
if(name == "security"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*10;
randompoint.z = scope.list[name].randompoint.z + Math.random()*2;
}
if(name == "entergate"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*5;
randompoint.z = scope.list[name].randompoint.z - Math.random()*2;
}
if(name == "standtop"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*100;
randompoint.z = scope.list[name].randompoint.z + Math.random();
}
if(name == "standdown"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*100;
randompoint.z = scope.list[name].randompoint.z ;
}
if(name == "exitgate"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*30;
randompoint.z = scope.list[name].randompoint.z + Math.random()*5;
}
// let random = Math.random();
return randompoint;
}
this.getzoneposition = function(name){
// let random = Math.random();
let position = scope.list[name].railline.getPointAt(Math.random());

View File

@ -7,6 +7,7 @@ export function ZoneModel(data) {
this.type = data.type;
this.stage = data.stage;
this.status = 0;
this.randompoint = data.randompoint;
//轨迹点
this.railpoints = data.railpoints;

View File

@ -66,12 +66,12 @@ export function Jlmap3dSubscribe(jlmap3d,routegroup,jsonwebwork) {
// if(event.data.type == 'Simulation_DeviceStatus'){
// devicestatus(event.data);
// }
// console.log(data);
if(event.data._type == 'Simulation_Driver_Change'){
drivingcode = event.data.body.code;
jlmap3d.updatedrivingcode( event.data.body.code);
}
if(event.data._type == 'Train'){
// console.log(event.data);
trainstatus(event.data);
}
if (event.data._type== 'Signal' && signallist) {

View File

@ -191,12 +191,12 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
scope.webwork.onmessage = function (event) {
//更新列车位置
// if(scope.datatype == "new"){
//
if(scope.datatype == "new"){
// UpdateTrainNew(camera,trainlisttest);
// }else{
// UpdateTrain(camera,trainlisttest);
// }
}else{
UpdateTrain(camera,trainlisttest);
}
if(camerarail.moveswitch == true){
// console.log(camerarail.progress);

View File

@ -8,6 +8,7 @@ export function Materialload(jlmap3dedit,assettype){
settexture( jlmap3dedit.materiallist,"black",'../../static/material/signal/5.jpg');
if(assettype){
if(assettype.stationtexture == "xian3"){
if(jlmap3dedit.stationtexture){
setstationtexture(jlmap3dedit.stationtexture,"stationlist",'../../static/texture/xian3/xian3list.jpg');
@ -69,6 +70,8 @@ export function Materialload(jlmap3dedit,assettype){
}
}
}
//console.log(jlmap3dedit.materiallist);
}

View File

@ -2,22 +2,24 @@
<div class="emergency_release">
<div class="emergency_release_header">
<div class="emergency_header_text">中心PIS紧急信息一览</div>
<el-table v-model="tableData" :header-cell-style="headerCellStyle" height="50%" style="width: 94%; position: relative;left: 3%">
<el-table :data="tableData" :header-cell-style="headerCellStyle" :cell-style="cellStyle" :height="'60%'" style="width: 94%; position: relative;left: 3%;">
<el-table-column prop="time" label="时间" width="150" />
<el-table-column prop="description" label="信息描述" />
<el-table-column prop="level" label="等级" />
</el-table>
<div style="width: 75%; position: relative;left: 3%;background: #FFF;margin-top: 10px;padding: 2px;display: inline-block">
<div style="margin-top: 10px;width: 100%;">
<div style="width: 75%;background: #FFF;padding: 2px;display: inline-block;vertical-align:top;margin-left: 3%">
<div style="width: 100%;text-align: center;font-size: 13px;padding-top:5px;">显示内容</div>
<div style="width:100%; height: 100px; border: 1px solid #000;" />
</div>
<div style="width: 15%;background: #939FAC; display: inline-block;margin-left: 6%;margin-top: 10px;">
<div style="width: 15%;background: #939FAC; display: inline-block;margin-left: 2%;">
<div class="emergency_select_button">区域详细</div>
<div style="width: 100%;text-align: center;color: #FFF;font-size: 13px;background: #121A86;">紧急信息清除</div>
<div style="width: 100%;text-align: center;color: #FFF;font-size: 13px;background: #121A86;height: 30px;line-height: 30px;">紧急信息清除</div>
<div class="emergency_select_button">清除</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
@ -25,14 +27,16 @@ export default {
data() {
return {
tableData: [],
headerCellStyle: {background: '#121A86', height: '25px', color: '#FFF'}
headerCellStyle: {background: '#121A86', height: '25px', color: '#FFF'},
cellStyle: {height:'25px'}
};
}
};
</script>
<style lang="scss" scoped>
.emergency_release{padding:20px;}
.emergency_release{padding:20px;height: 100%;}
.emergency_release_header{height: 100%;}
.emergency_header_text{margin-top:10px;text-align: center;color: #9af1ec;font-size: 18px;padding-bottom: 10px;}
.emergency_select_button {
text-align: center;
@ -43,7 +47,7 @@ export default {
border-left: 2px solid #FFF;
border-right: 2px solid #898888;
border-bottom: 2px solid #898888;
margin: 5px 12px 10px;
margin: 10px auto 5px;
font-size: 14px;
line-height: 30px;
cursor:pointer;
@ -52,7 +56,7 @@ export default {
-ms-user-select:none;
user-select:none;
}
.emergency_select_button :active {
.emergency_select_button:active {
border-top: 2px solid #898888;
border-left: 2px solid #898888;
border-right: 2px solid #FFF;
@ -62,4 +66,8 @@ export default {
.el-table th{
padding: 0;
}
/deep/
.el-table td{
padding: 0;
}
</style>

View File

@ -138,6 +138,7 @@ import axios from 'axios';
}
},
updatetrainlist(){
console.log(this.group);
getSimulationTrainlistNew(this.group).then(netdata => {
this.options = [];
this.trainlist = netdata.data;

View File

@ -3,11 +3,11 @@
<div id="jl3d" class="jl3ddraw">
</div>
<!-- <div class="menutop">
<div class="menutop">
<el-button-group>
<el-button type="primary" @click="switchrender">{{rendermode}}</el-button>
</el-button-group>
</div> -->
</div>
<div class="menudown">
<el-button-group>
<el-button type="primary" @click="back">退出</el-button>
@ -18,7 +18,7 @@
</template>
<script>
import Vue from 'vue';
import { Jl3dpassflow } from '@/jlmap3d/jl3dpassflow/jl3dpassflow.js';
import { Jl3dpassflow } from '@/jlmap3d/jl3dpassflow/jl3dpassflownew.js';
import { ProjectIcon } from '@/scripts/ProjectConfig';
export default {

View File

@ -71,14 +71,14 @@ export default {
title: '理论分数',
prop: 'theoryScore',
type: 'tag',
columnValue: (row) => { return row.artificialTheoryScore ? `${row.theoryScore}(${row.artificialTheoryScore})` : row.theoryScore || ''; },
columnValue: (row) => { return row.artificialTheoryScore ? `${row.theoryScore}(${row.artificialTheoryScore})` : row.theoryScore || '0'; },
tagType: (row) => { return 'success'; }
},
{
title: '实操分数',
prop: 'practiceScore',
type: 'tag',
columnValue: (row) => { return row.artificialPracticeScore ? `${row.practiceScore}(${row.artificialPracticeScore})` : row.practiceScore || ''; },
columnValue: (row) => { return row.artificialPracticeScore ? `${row.practiceScore}(${row.artificialPracticeScore})` : row.practiceScore || '0'; },
tagType: (row) => { return 'success'; }
},
{

View File

@ -188,7 +188,8 @@ export default {
'04': '02', // =>
'05': '' // => null
},
dataError: false
dataError: false,
planRunning:false
};
},
computed: {
@ -278,10 +279,14 @@ export default {
this.mapBoxP = document.getElementById(this.canvasId).children[0];
this.mapBoxP.style.cursor = '';
// this.mapBox = document.getElementsByTagName('canvas');
if (this.planRunning) {
this.$store.dispatch('training/simulationStart');
}
if (this.trainingId) {
getTrainingStepsDetailNew(this.trainingId, { group: this.group }).then(resp => {
this.trainingObj = resp.data;
this.$store.dispatch('training/setTrainingData', this.trainingObj);
}).catch(error => {
this.$messageBox(`初始化失败实训内容失败: ${error.message}`);
});
@ -434,7 +439,7 @@ export default {
this.questId = Number(resp.data.questId) || 0;
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
if (resp.data.planRunning) {
this.$store.dispatch('training/simulationStart');
this.planRunning = resp.data.planRunning;
} else {
this.$store.dispatch('training/over');
}

View File

@ -435,8 +435,14 @@ export default {
let list = [];
nameList.forEach(item => {
if (this.$store.state.map.map[item] && this.$store.state.map.map[item].constructor === Array) {
if (item === 'trainList') {
this.$store.state.map.map[item].forEach(elem => {
elem && list.push(elem);
});
} else {
list = [...list, ...this.$store.state.map.map[item]];
}
}
});
this.$jlmap.updateShowStation(list, stationCode);
!isTraining && this.setCenter(stationCode);

View File

@ -5,13 +5,13 @@
<div :class="chatContent.self?'rightUser':'leftUser'">
<div class="userHeader">
<!-- chatContent.all&& -->
<div v-if="!chatContent.self" class="userName">{{ covertName(chatContent.member) }}</div>
<div v-if="!chatContent.self" class="userName">{{ covertName(chatContent.member,false) }}</div>
<div :class="chatContent.self?'userChatTime textRight':'userChatTime'">{{ formatTime(chatContent.chatTime) }}</div>
</div>
<div class="userBubble" @click="playAudio(baseUrl+chatContent.src)">
<div class="userMessage">
<!-- chatContent.all&& -->
<span v-if="!chatContent.member.robot">{{ covertName(chatContent.targetUser) }}</span>
<span v-if="!chatContent.member.robot&&chatContent.all">{{ covertName(chatContent.targetUser,true) }}</span>
<span class="el-icon-video-play playicon" />
<span class="messageText">{{ chatContent.message }}</span>
</div>
@ -141,22 +141,22 @@ export default {
};
});
},
covertName(data) {
covertName(data, status) {
if (data != 'All') {
if (data instanceof Array) {
let result = '';
data.forEach(each=>{
result += this.covertEachName(each);
result += this.covertEachName(each, status);
});
return result;
} else {
return this.covertEachName(data);
return this.covertEachName(data, status);
}
} else {
return '@All';
}
},
covertEachName(data) {
covertEachName(data, status) {
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
roleTypeList.forEach(function(element) {
const rolename = element.value;
@ -172,7 +172,11 @@ export default {
});
const deviceName = data.deviceName ? '-' + data.deviceName : '';
const memberName = data.name ? '-' + data.name : '';
if (status) {
return '@' + data.role + deviceName + memberName;
} else {
return data.role + deviceName + memberName;
}
},
playAudio(audioUrl) {
document.querySelector('#audioPlay').src = audioUrl;

Binary file not shown.

View File

@ -675,7 +675,7 @@ function timedCount(){
// postMessage(data);
// }
//
console.log(e.data);
// console.log(e.data);
if(e.data.type == "init"){
topic = e.data.topic;
@ -695,7 +695,7 @@ function timedCount(){
function callback(Response) {
// console.log(Response);
data = JSON.parse(Response.body);
console.log(data);
// console.log(data);
if(data.type == 'SJL3D_TrainStatus'){
for (let i=0,leni = data.body.length; i<leni; i++) {
postMessage(data.body[i]);