mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
ATC clocks now synched to mission time
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { getMissionData } from "..";
|
||||
import { getConnected } from "../server/server";
|
||||
import { ATCBoard } from "./atcboard";
|
||||
import { ATCBoardGround } from "./board/ground";
|
||||
import { ATCBoardTower } from "./board/tower";
|
||||
@@ -48,6 +50,10 @@ class ATCDataHandler {
|
||||
|
||||
this.#updateInterval = window.setInterval( () => {
|
||||
|
||||
if ( !getConnected() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const aBoardIsVisible = this.#atc.getBoards().some( board => board.boardIsVisible() );
|
||||
|
||||
if ( aBoardIsVisible ) {
|
||||
@@ -135,7 +141,7 @@ export class ATC {
|
||||
|
||||
|
||||
getMissionDateTime() : Date {
|
||||
return new Date( this.getMissionStartDateTime().getTime() + this.getMissionElapsedSeconds() );
|
||||
return new Date( getMissionData().getNowDate() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@ import { Dropdown } from "../controls/dropdown";
|
||||
import { zeroAppend } from "../other/utils";
|
||||
import { ATC } from "./atc";
|
||||
import { Unit } from "../units/unit";
|
||||
import { getUnitsManager } from "..";
|
||||
import { getMissionData, getUnitsManager } from "..";
|
||||
import Sortable from "sortablejs";
|
||||
import { FlightInterface } from "./atc";
|
||||
import { getConnected } from "../server/server";
|
||||
|
||||
export interface StripBoardStripInterface {
|
||||
"id": string,
|
||||
@@ -84,6 +85,10 @@ export abstract class ATCBoard {
|
||||
|
||||
|
||||
window.setInterval( () => {
|
||||
|
||||
if ( !getConnected() ) {
|
||||
return;
|
||||
}
|
||||
this.updateClock();
|
||||
}, 1000 );
|
||||
|
||||
@@ -410,6 +415,10 @@ export abstract class ATCBoard {
|
||||
|
||||
this.#updateInterval = window.setInterval( () => {
|
||||
|
||||
if ( !getConnected() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.update();
|
||||
|
||||
}, this.#updateIntervalDelay );
|
||||
@@ -446,8 +455,12 @@ export abstract class ATCBoard {
|
||||
|
||||
updateClock() {
|
||||
|
||||
const now = this.#atc.getMissionDateTime();
|
||||
this.#clockElement.innerText = now.toLocaleTimeString();
|
||||
const missionTime = this.#atc.getMissionDateTime().getTime();
|
||||
const timeDiff = new Date().getTime() - getMissionData().getUpdateTime();
|
||||
|
||||
const nowDate = new Date( missionTime + timeDiff );
|
||||
|
||||
this.#clockElement.innerText = nowDate.toLocaleTimeString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user