Completed first iteration of drawings management on v2

This commit is contained in:
Davide Passoni
2025-02-26 09:39:30 +01:00
parent 1a93ee68d0
commit b2477112b1
17 changed files with 1041 additions and 17 deletions

View File

@@ -4,6 +4,7 @@ import {
AIRBASES_URI,
BULLSEYE_URI,
COMMANDS_URI,
DRAWINGS_URI,
LOGS_URI,
MISSION_URI,
NONE,
@@ -220,6 +221,10 @@ export class ServerManager {
this.GET(callback, errorCallback, WEAPONS_URI, { time: refresh ? 0 : this.#lastUpdateTimes[WEAPONS_URI] }, "arraybuffer", refresh);
}
getDrawings(callback: CallableFunction, errorCallback: CallableFunction, refresh: boolean = false) {
this.GET(callback, errorCallback, DRAWINGS_URI);
}
isCommandExecuted(callback: CallableFunction, commandHash: string, errorCallback: CallableFunction = () => {}) {
this.GET(callback, errorCallback, COMMANDS_URI, {
commandHash: commandHash,
@@ -577,6 +582,17 @@ export class ServerManager {
this.PUT(data, callback);
}
loadEnvResources() {
/* Load the drawings */
this.getDrawings((drawingsData: { drawings: Record<string, Record<string, any>> }) => {
if (drawingsData) {
getApp().getDrawingsManager()?.initDrawings(drawingsData);
}
}, () => {});
// TODO: load navPoints
}
startUpdate() {
/* Clear any existing interval */
this.#intervals.forEach((interval: number) => {
@@ -584,6 +600,9 @@ export class ServerManager {
});
this.#intervals = [];
// Load mission env resources (one shot)
this.loadEnvResources();
this.#intervals.push(
window.setInterval(() => {
if (!this.getPaused()) {