mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Completed first iteration of drawings management on v2
This commit is contained in:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user