mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Merge pull request #280 from Pax1601/278-put-real-mission-times-into-atc
278 put real mission times into atc
This commit is contained in:
11
client/package-lock.json
generated
11
client/package-lock.json
generated
@@ -10,6 +10,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/geojson": "^7946.0.10",
|
"@types/geojson": "^7946.0.10",
|
||||||
"@types/leaflet": "^1.9.0",
|
"@types/leaflet": "^1.9.0",
|
||||||
|
"@types/svg-injector": "^0.0.29",
|
||||||
"cookie-parser": "~1.4.4",
|
"cookie-parser": "~1.4.4",
|
||||||
"debug": "~2.6.9",
|
"debug": "~2.6.9",
|
||||||
"ejs": "^3.1.8",
|
"ejs": "^3.1.8",
|
||||||
@@ -1865,6 +1866,11 @@
|
|||||||
"integrity": "sha512-qrhtM7M41EhH4tZQTNw2/RJkxllBx3reiJpTbgWCM2Dx0U1sZ6LwKp9lfNln9uqE26ZMKUaPEYaD4rzvOWYtZw==",
|
"integrity": "sha512-qrhtM7M41EhH4tZQTNw2/RJkxllBx3reiJpTbgWCM2Dx0U1sZ6LwKp9lfNln9uqE26ZMKUaPEYaD4rzvOWYtZw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/svg-injector": {
|
||||||
|
"version": "0.0.29",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/svg-injector/-/svg-injector-0.0.29.tgz",
|
||||||
|
"integrity": "sha512-tNvoN0Xk2si6IfxQI/PqInipOuCyXkDZhCh9Vc4aFv/l1DhIBfTFbXRXYUHBAGXaUNMOCHEtg9475O9J+4NXOg=="
|
||||||
|
},
|
||||||
"node_modules/abbrev": {
|
"node_modules/abbrev": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||||
@@ -6989,6 +6995,11 @@
|
|||||||
"integrity": "sha512-qrhtM7M41EhH4tZQTNw2/RJkxllBx3reiJpTbgWCM2Dx0U1sZ6LwKp9lfNln9uqE26ZMKUaPEYaD4rzvOWYtZw==",
|
"integrity": "sha512-qrhtM7M41EhH4tZQTNw2/RJkxllBx3reiJpTbgWCM2Dx0U1sZ6LwKp9lfNln9uqE26ZMKUaPEYaD4rzvOWYtZw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/svg-injector": {
|
||||||
|
"version": "0.0.29",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/svg-injector/-/svg-injector-0.0.29.tgz",
|
||||||
|
"integrity": "sha512-tNvoN0Xk2si6IfxQI/PqInipOuCyXkDZhCh9Vc4aFv/l1DhIBfTFbXRXYUHBAGXaUNMOCHEtg9475O9J+4NXOg=="
|
||||||
|
},
|
||||||
"abbrev": {
|
"abbrev": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/geojson": "^7946.0.10",
|
"@types/geojson": "^7946.0.10",
|
||||||
"@types/leaflet": "^1.9.0",
|
"@types/leaflet": "^1.9.0",
|
||||||
|
"@types/svg-injector": "^0.0.29",
|
||||||
"cookie-parser": "~1.4.4",
|
"cookie-parser": "~1.4.4",
|
||||||
"debug": "~2.6.9",
|
"debug": "~2.6.9",
|
||||||
"ejs": "^3.1.8",
|
"ejs": "^3.1.8",
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
|
.ol-strip-board .ol-dialog-header {
|
||||||
|
align-items: center;
|
||||||
|
display:flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
.ol-strip-board-strips {
|
.ol-strip-board-strips {
|
||||||
display:flex;
|
display:flex;
|
||||||
@@ -178,6 +182,7 @@
|
|||||||
|
|
||||||
.ol-strip-board-add-flight .ol-auto-suggest[data-has-suggestions] {
|
.ol-strip-board-add-flight .ol-auto-suggest[data-has-suggestions] {
|
||||||
display:flex;
|
display:flex;
|
||||||
|
row-gap: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ol-strip-board-add-flight .ol-auto-suggest[data-has-suggestions] a {
|
.ol-strip-board-add-flight .ol-auto-suggest[data-has-suggestions] a {
|
||||||
@@ -192,4 +197,9 @@
|
|||||||
[data-board-type="tower"] {
|
[data-board-type="tower"] {
|
||||||
right:10px;
|
right:10px;
|
||||||
top:10px;
|
top:10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-board-type="tower"] .ol-auto-suggest {
|
||||||
|
top:30px;
|
||||||
|
translate:0;
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { getMissionData } from "..";
|
||||||
|
import { getConnected } from "../server/server";
|
||||||
import { ATCBoard } from "./atcboard";
|
import { ATCBoard } from "./atcboard";
|
||||||
import { ATCBoardGround } from "./board/ground";
|
import { ATCBoardGround } from "./board/ground";
|
||||||
import { ATCBoardTower } from "./board/tower";
|
import { ATCBoardTower } from "./board/tower";
|
||||||
@@ -48,6 +50,10 @@ class ATCDataHandler {
|
|||||||
|
|
||||||
this.#updateInterval = window.setInterval( () => {
|
this.#updateInterval = window.setInterval( () => {
|
||||||
|
|
||||||
|
if ( !getConnected() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const aBoardIsVisible = this.#atc.getBoards().some( board => board.boardIsVisible() );
|
const aBoardIsVisible = this.#atc.getBoards().some( board => board.boardIsVisible() );
|
||||||
|
|
||||||
if ( aBoardIsVisible ) {
|
if ( aBoardIsVisible ) {
|
||||||
@@ -135,7 +141,7 @@ export class ATC {
|
|||||||
|
|
||||||
|
|
||||||
getMissionDateTime() : Date {
|
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 { zeroAppend } from "../other/utils";
|
||||||
import { ATC } from "./atc";
|
import { ATC } from "./atc";
|
||||||
import { Unit } from "../units/unit";
|
import { Unit } from "../units/unit";
|
||||||
import { getUnitsManager } from "..";
|
import { getMissionData, getUnitsManager } from "..";
|
||||||
import Sortable from "sortablejs";
|
import Sortable from "sortablejs";
|
||||||
import { FlightInterface } from "./atc";
|
import { FlightInterface } from "./atc";
|
||||||
|
import { getConnected } from "../server/server";
|
||||||
|
|
||||||
export interface StripBoardStripInterface {
|
export interface StripBoardStripInterface {
|
||||||
"id": string,
|
"id": string,
|
||||||
@@ -84,6 +85,10 @@ export abstract class ATCBoard {
|
|||||||
|
|
||||||
|
|
||||||
window.setInterval( () => {
|
window.setInterval( () => {
|
||||||
|
|
||||||
|
if ( !getConnected() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.updateClock();
|
this.updateClock();
|
||||||
}, 1000 );
|
}, 1000 );
|
||||||
|
|
||||||
@@ -410,6 +415,10 @@ export abstract class ATCBoard {
|
|||||||
|
|
||||||
this.#updateInterval = window.setInterval( () => {
|
this.#updateInterval = window.setInterval( () => {
|
||||||
|
|
||||||
|
if ( !getConnected() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
|
|
||||||
}, this.#updateIntervalDelay );
|
}, this.#updateIntervalDelay );
|
||||||
@@ -446,8 +455,12 @@ export abstract class ATCBoard {
|
|||||||
|
|
||||||
updateClock() {
|
updateClock() {
|
||||||
|
|
||||||
const now = this.#atc.getMissionDateTime();
|
const missionTime = this.#atc.getMissionDateTime().getTime();
|
||||||
this.#clockElement.innerText = now.toLocaleTimeString();
|
const timeDiff = new Date().getTime() - getMissionData().getUpdateTime();
|
||||||
|
|
||||||
|
const nowDate = new Date( missionTime + timeDiff );
|
||||||
|
|
||||||
|
this.#clockElement.innerText = nowDate.toLocaleTimeString();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export interface FeatureSwitchInterface {
|
export interface FeatureSwitchInterface {
|
||||||
"defaultEnabled": boolean, // default on/off state (if allowed by masterSwitch)
|
"defaultEnabled": boolean, // default on/off state (if allowed by forceState)
|
||||||
|
"forceState": number, // -1 don't force; 0 force off; 1 force on
|
||||||
"label": string,
|
"label": string,
|
||||||
"masterSwitch": boolean, // on/off regardless of user preference
|
|
||||||
"name": string,
|
"name": string,
|
||||||
"onEnabled"?: CallableFunction,
|
"onEnabled"?: CallableFunction,
|
||||||
"options"?: object,
|
"options"?: object,
|
||||||
@@ -13,8 +13,8 @@ class FeatureSwitch {
|
|||||||
|
|
||||||
// From config param
|
// From config param
|
||||||
defaultEnabled;
|
defaultEnabled;
|
||||||
|
forceState = -1;
|
||||||
label;
|
label;
|
||||||
masterSwitch;
|
|
||||||
name;
|
name;
|
||||||
onEnabled;
|
onEnabled;
|
||||||
removeArtifactsIfDisabled = true;
|
removeArtifactsIfDisabled = true;
|
||||||
@@ -26,10 +26,10 @@ class FeatureSwitch {
|
|||||||
constructor(config: FeatureSwitchInterface) {
|
constructor(config: FeatureSwitchInterface) {
|
||||||
|
|
||||||
this.defaultEnabled = config.defaultEnabled;
|
this.defaultEnabled = config.defaultEnabled;
|
||||||
this.label = config.label;
|
this.forceState = config.forceState;
|
||||||
this.masterSwitch = config.masterSwitch;
|
this.label = config.label;
|
||||||
this.name = config.name;
|
this.name = config.name;
|
||||||
this.onEnabled = config.onEnabled;
|
this.onEnabled = config.onEnabled;
|
||||||
|
|
||||||
this.userPreference = this.getUserPreference();
|
this.userPreference = this.getUserPreference();
|
||||||
|
|
||||||
@@ -47,10 +47,14 @@ class FeatureSwitch {
|
|||||||
|
|
||||||
isEnabled() {
|
isEnabled() {
|
||||||
|
|
||||||
if (!this.masterSwitch) {
|
if ( this.forceState === 0 ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( this.forceState === 1 ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return this.userPreference;
|
return this.userPreference;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,37 +66,37 @@ export class FeatureSwitches {
|
|||||||
|
|
||||||
new FeatureSwitch({
|
new FeatureSwitch({
|
||||||
"defaultEnabled": false,
|
"defaultEnabled": false,
|
||||||
|
"forceState": -1,
|
||||||
"label": "AIC",
|
"label": "AIC",
|
||||||
"masterSwitch": true,
|
|
||||||
"name": "aic"
|
"name": "aic"
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new FeatureSwitch({
|
new FeatureSwitch({
|
||||||
"defaultEnabled": false,
|
"defaultEnabled": false,
|
||||||
|
"forceState": -1,
|
||||||
"label": "AI Formations",
|
"label": "AI Formations",
|
||||||
"masterSwitch": true,
|
|
||||||
"name": "ai-formations",
|
"name": "ai-formations",
|
||||||
"removeArtifactsIfDisabled": false
|
"removeArtifactsIfDisabled": false
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new FeatureSwitch({
|
new FeatureSwitch({
|
||||||
"defaultEnabled": false,
|
"defaultEnabled": false,
|
||||||
|
"forceState": 1,
|
||||||
"label": "ATC",
|
"label": "ATC",
|
||||||
"masterSwitch": true,
|
|
||||||
"name": "atc"
|
"name": "atc"
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new FeatureSwitch({
|
new FeatureSwitch({
|
||||||
"defaultEnabled": false,
|
"defaultEnabled": false,
|
||||||
|
"forceState": -1,
|
||||||
"label": "Force show unit control panel",
|
"label": "Force show unit control panel",
|
||||||
"masterSwitch": true,
|
|
||||||
"name": "forceShowUnitControlPanel"
|
"name": "forceShowUnitControlPanel"
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new FeatureSwitch({
|
new FeatureSwitch({
|
||||||
"defaultEnabled": true,
|
"defaultEnabled": true,
|
||||||
|
"forceState": -1,
|
||||||
"label": "Show splash screen",
|
"label": "Show splash screen",
|
||||||
"masterSwitch": true,
|
|
||||||
"name": "splashScreen"
|
"name": "splashScreen"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,14 @@ export class MissionHandler
|
|||||||
#airbases : {[name: string]: Airbase} = {};
|
#airbases : {[name: string]: Airbase} = {};
|
||||||
#theatre : string = "";
|
#theatre : string = "";
|
||||||
|
|
||||||
|
// Time
|
||||||
|
#date : any;
|
||||||
|
#elapsedTime : any;
|
||||||
|
#startTime : any;
|
||||||
|
#time : any;
|
||||||
|
|
||||||
|
#updateTime : any;
|
||||||
|
|
||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -64,6 +72,28 @@ export class MissionHandler
|
|||||||
|
|
||||||
getInfoPopup().setText("Map set to " + this.#theatre);
|
getInfoPopup().setText("Map set to " + this.#theatre);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( "date" in data.mission ) {
|
||||||
|
this.#date = data.mission.date;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( "elapsedTime" in data.mission ) {
|
||||||
|
this.#elapsedTime = data.mission.elapsedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( "startTime" in data.mission ) {
|
||||||
|
this.#startTime = data.mission.startTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( "time" in data.mission ) {
|
||||||
|
this.#time = data.mission.time;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( "time" in data ) {
|
||||||
|
this.#updateTime = data.time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +102,41 @@ export class MissionHandler
|
|||||||
return this.#bullseyes;
|
return this.#bullseyes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDate() {
|
||||||
|
return this.#date;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getNowDate() {
|
||||||
|
|
||||||
|
const date = this.getDate();
|
||||||
|
const time = this.getTime();
|
||||||
|
|
||||||
|
if ( !date ) {
|
||||||
|
return new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
let year = date.Year;
|
||||||
|
let month = date.Month - 1;
|
||||||
|
|
||||||
|
if ( month < 0 ) {
|
||||||
|
month = 11;
|
||||||
|
year--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Date( year, month, date.Day, time.h, time.m, time.s );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getTime() {
|
||||||
|
return this.#time;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getUpdateTime() {
|
||||||
|
return this.#updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
#onAirbaseClick(e: any)
|
#onAirbaseClick(e: any)
|
||||||
{
|
{
|
||||||
getMap().showAirbaseContextMenu(e, e.sourceTarget);
|
getMap().showAirbaseContextMenu(e, e.sourceTarget);
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<div id="<%= boardId %>" class="ol-panel ol-dialog ol-strip-board ol-draggable" data-board-type="<%= boardType %>" data-feature-switch="atc">
|
<div id="<%= boardId %>" class="ol-panel ol-dialog ol-strip-board ol-draggable hide" data-board-type="<%= boardType %>" data-feature-switch="atc">
|
||||||
|
|
||||||
<div class="ol-dialog-close" data-on-click="closeDialog"></div>
|
<div class="ol-dialog-close" data-on-click="closeDialog"></div>
|
||||||
|
|
||||||
<div class="ol-dialog-header">
|
<div class="ol-dialog-header">
|
||||||
<h3><%= boardType %></h3>
|
<h3><%= boardType %></h3>
|
||||||
|
<%- include('addflight.ejs') %>
|
||||||
<div class="ol-strip-board-clock"></div>
|
<div class="ol-strip-board-clock"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -18,8 +19,4 @@
|
|||||||
<div class="ol-strip-board-strips ol-sortable"></div>
|
<div class="ol-strip-board-strips ol-sortable"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ol-dialog-footer">
|
|
||||||
<%- include('addflight.ejs') %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
Reference in New Issue
Block a user