Loaded state save
This commit is contained in:
parent
c7e9bff5e2
commit
57186d44b9
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tfdidesign-md11-load-manager",
|
"name": "tfdidesign-md11-load-manager",
|
||||||
"version": "0.1.64",
|
"version": "0.1.74",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@ -59,7 +59,7 @@ const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, setLoadingState })
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!simBrief) return;
|
if (!simBrief || GSXActive()) return;
|
||||||
|
|
||||||
setSBInFlight(true);
|
setSBInFlight(true);
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, setLoadingState })
|
|||||||
|
|
||||||
setFuel(parseFloat((SBResponse.message as SimBrief).fuel as unknown as string) ?? 0);
|
setFuel(parseFloat((SBResponse.message as SimBrief).fuel as unknown as string) ?? 0);
|
||||||
setSBInFlight(false);
|
setSBInFlight(false);
|
||||||
}, [simBrief]);
|
}, [simBrief, GSXActive()]);
|
||||||
|
|
||||||
useEffect(
|
useEffect(
|
||||||
() =>
|
() =>
|
||||||
|
|||||||
@ -59,7 +59,7 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, setLoadingState
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!simBrief) return;
|
if (!simBrief || GSXActive()) return;
|
||||||
|
|
||||||
setSBInFlight(true);
|
setSBInFlight(true);
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, setLoadingState
|
|||||||
|
|
||||||
setFuel(parseFloat((SBResponse.message as SimBrief).fuel as unknown as string) ?? 0);
|
setFuel(parseFloat((SBResponse.message as SimBrief).fuel as unknown as string) ?? 0);
|
||||||
setSBInFlight(false);
|
setSBInFlight(false);
|
||||||
}, [simBrief]);
|
}, [simBrief, GSXActive()]);
|
||||||
|
|
||||||
useEffect(
|
useEffect(
|
||||||
() =>
|
() =>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { FC, useState } from 'react';
|
import { FC, useEffect, useState } from 'react';
|
||||||
import { GSX_SERVICE_CALLED, GSX_SERVICE_FINISHED } from '../../constants';
|
import { GSX_SERVICE_CALLED, GSX_SERVICE_FINISHED } from '../../constants';
|
||||||
import { LoadingState } from '../../types/general';
|
import { LoadingState } from '../../types/general';
|
||||||
import { WASMDataPax } from '../../types/WASMData';
|
import { WASMDataPax } from '../../types/WASMData';
|
||||||
@ -84,6 +84,10 @@ const Pax: FC<PaxProps> = ({ WASMData, username }) => {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setLoadingState(WASMData.loaded ? 'loaded' : 'preview');
|
||||||
|
}, [WASMData.loaded]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Profile
|
<Profile
|
||||||
|
|||||||
@ -6,6 +6,7 @@ interface WASMData {
|
|||||||
ZFW: number;
|
ZFW: number;
|
||||||
GW: number;
|
GW: number;
|
||||||
};
|
};
|
||||||
|
loaded: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WASMDataPax extends WASMData {
|
export interface WASMDataPax extends WASMData {
|
||||||
|
|||||||
@ -9,6 +9,7 @@ fPayloadData_t* liveFPayloadData;
|
|||||||
fPayloadData_t* targetFPayloadData;
|
fPayloadData_t* targetFPayloadData;
|
||||||
FuelData_t* liveFuelData;
|
FuelData_t* liveFuelData;
|
||||||
UserOptions_t* UserOptions;
|
UserOptions_t* UserOptions;
|
||||||
|
bool AircraftLoaded;
|
||||||
|
|
||||||
// Operational
|
// Operational
|
||||||
bool commBusCallbackRegistered;
|
bool commBusCallbackRegistered;
|
||||||
@ -597,6 +598,8 @@ int receiveData(const char* buf) {
|
|||||||
load(targetPaxPayloadData, simConnect, UserData->isImperial);
|
load(targetPaxPayloadData, simConnect, UserData->isImperial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AircraftLoaded = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Trigger unload
|
// Trigger unload
|
||||||
@ -608,6 +611,8 @@ int receiveData(const char* buf) {
|
|||||||
unload(simConnect, UserData->isER);
|
unload(simConnect, UserData->isER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AircraftLoaded = false;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Option set
|
// Option set
|
||||||
@ -847,6 +852,7 @@ void sendData () {
|
|||||||
document.AddMember("limits", limits.Move(), allocator);
|
document.AddMember("limits", limits.Move(), allocator);
|
||||||
document.AddMember("options", options.Move(), allocator);
|
document.AddMember("options", options.Move(), allocator);
|
||||||
document.AddMember("sbPlanned", sbPlanned.Move(), allocator);
|
document.AddMember("sbPlanned", sbPlanned.Move(), allocator);
|
||||||
|
document.AddMember("loaded", AircraftLoaded, allocator);
|
||||||
|
|
||||||
// Write to CommBus
|
// Write to CommBus
|
||||||
document.Accept(writer);
|
document.Accept(writer);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user