Merge branch 'main' into 296-create-airbases-api

This commit is contained in:
PeekabooSteam
2023-05-29 12:10:10 +01:00
committed by GitHub
8 changed files with 144 additions and 23 deletions

View File

@@ -9,8 +9,18 @@ export class MissionHandler
#airbases : {[name: string]: Airbase} = {};
#theatre : string = "";
#airbaseData : { [name: string]: object } = {};
// Time
#date : any;
#elapsedTime : any;
#startTime : any;
#time : any;
#updateTime : any;
constructor()
{
@@ -77,6 +87,40 @@ export class MissionHandler
//this.#airbases[idx].setParkings(["2x big", "5x small"]);
}
}
if ("mission" in data)
{
if (data.mission != null && data.mission.theatre != this.#theatre)
{
this.#theatre = data.mission.theatre;
getMap().setTheatre(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;
}
}
getBullseyes()
@@ -84,6 +128,41 @@ export class MissionHandler
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)
{
getMap().showAirbaseContextMenu(e, e.sourceTarget);