仿真倍速同步

This commit is contained in:
fan 2023-05-21 13:54:49 +08:00
parent 5e55daf3a4
commit c23bf6ba72
3 changed files with 17 additions and 2 deletions

View File

@ -102,7 +102,13 @@ function callback(Response) {
} else if (Response.headers.destination.includes('sysTime')) {
store.dispatch('socket/setSimulationTimeSync', Number.parseInt(Response.body));
} else if (Response.headers.destination.includes('state')) {
store.dispatch('socket/handleSimulationState', Number.parseInt(Response.body));
const msg = JSON.parse(Response.body);
if (msg.state) {
store.dispatch('socket/handleSimulationState', Number.parseInt(msg.state));
}
if (msg.speed) {
store.dispatch('socket/setSimulationSpeed', Number.parseInt(msg.speed));
}
} else if (Response.headers.destination.includes('iscs/psd') || Response.headers.destination.includes('iscs/gate')) {
store.dispatch('socket/handleIscsState', JSON.parse(Response.body));
} else if (Response.headers.destination.includes('iscs/pa')) {

View File

@ -8,7 +8,13 @@ export function sysTimeCallback(Response) {
store.dispatch('socket/setSimulationTimeSync', Number.parseInt(Response.body));
}
export function stateCallback(Response) {
store.dispatch('socket/handleSimulationState', Number.parseInt(Response.body));
const msg = JSON.parse(Response.body);
if (msg.state) {
store.dispatch('socket/handleSimulationState', Number.parseInt(msg.state));
}
if (msg.speed) {
store.dispatch('socket/setSimulationSpeed', Number.parseInt(msg.speed));
}
}
export function iscsPsdCallback(Response) {
store.dispatch('socket/handleIscsState', JSON.parse(Response.body));

View File

@ -94,6 +94,9 @@ export default {
watch: {
'$store.state.socket.simulationTimeSync': function (time) { // 仿
this.initDate(time);
},
'$store.state.socket.simulationSpeed': function(speed) {
this.speed = speed;
}
},
mounted() {