1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-12-28 07:11:59 +00:00

Started development v3.4.2

This commit is contained in:
Stanley 2022-08-04 23:43:51 -04:00
parent ea098e9033
commit c16b3fefaf
9 changed files with 52 additions and 13 deletions

View file

@ -10,6 +10,8 @@ namespace MSFSPopoutPanelManager.Orchestration
public string CurrentMsfsAircraft { get; set; }
public string CurrentMsfsLiveryTitle { get; set; }
public bool HasCurrentMsfsAircraft
{
get { return !String.IsNullOrEmpty(CurrentMsfsAircraft); }
@ -35,6 +37,7 @@ namespace MSFSPopoutPanelManager.Orchestration
public void ClearData()
{
CurrentMsfsAircraft = null;
CurrentMsfsLiveryTitle = null;
ElectricalMasterBatteryStatus = false;
IsEnteredFlight = false;
}

View file

@ -46,6 +46,16 @@ namespace MSFSPopoutPanelManager.Orchestration
var aircraftName = Convert.ToString(e.Find(d => d.PropName == "AircraftName").Value);
aircraftName = String.IsNullOrEmpty(aircraftName) ? null : aircraftName;
var electricalMasterBattery = Convert.ToBoolean(e.Find(d => d.PropName == "ElectricalMasterBattery").Value);
var liveryName = Convert.ToString(e.Find(d => d.PropName == "Title").Value);
if (electricalMasterBattery != FlightSimData.ElectricalMasterBatteryStatus)
FlightSimData.ElectricalMasterBatteryStatus = electricalMasterBattery;
if (liveryName != FlightSimData.CurrentMsfsLiveryTitle)
{
FlightSimData.CurrentMsfsLiveryTitle = liveryName;
ProfileData.MigrateLiveryToAircraftBinding(liveryName, aircraftName);
}
// Automatic switching of active profile when SimConnect active aircraft change
if (FlightSimData.CurrentMsfsAircraft != aircraftName)
@ -53,9 +63,6 @@ namespace MSFSPopoutPanelManager.Orchestration
FlightSimData.CurrentMsfsAircraft = aircraftName;
ProfileData.AutoSwitchProfile(aircraftName);
}
if (electricalMasterBattery != FlightSimData.ElectricalMasterBatteryStatus)
FlightSimData.ElectricalMasterBatteryStatus = electricalMasterBattery;
};
_simConnectProvider.OnFlightStarted += (sender, e) => OnFlightStarted?.Invoke(this, null);
_simConnectProvider.OnFlightStopped += HandleOnFlightStopped;

View file

@ -231,7 +231,7 @@ namespace MSFSPopoutPanelManager.Orchestration
{
case PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND:
// Move window back to original location
PInvoke.MoveWindow(panelConfig.PanelHandle, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height, false);
WindowActionManager.MoveWindow(panelConfig.PanelHandle, panelConfig.PanelType, panelConfig.Left, panelConfig.Top, panelConfig.Width, panelConfig.Height);
break;
case PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE:
// Detect if window is maximized, if so, save settings

View file

@ -170,5 +170,20 @@ namespace MSFSPopoutPanelManager.Orchestration
UpdateActiveProfile(matchedProfile.ProfileId);
}
}
// This is to migrate profile binding from aircraft livery to aircraft name
// Started in v3.4.2
public void MigrateLiveryToAircraftBinding(string liveryName, string aircraftName)
{
if (Profiles != null)
{
var matchedProfile = Profiles.FirstOrDefault(p => p.BindingAircraftLiveries.Any(t => t == liveryName));
if (matchedProfile != null && !matchedProfile.BindingAircrafts.Any(a => a == aircraftName))
{
matchedProfile.BindingAircrafts.Add(aircraftName);
WriteProfiles();
}
}
}
}
}

View file

@ -69,8 +69,8 @@
"width": 1408,
"height": 914
},
"showMenuBar": false,
"enableMap": false,
"showMenuBar": true,
"enableMap": true,
"subPanels": [
{
"panelId": "pfd",

View file

@ -351,7 +351,10 @@
"actionType": "EncoderAction"
}
],
"useDualEncoder": true
"useDualEncoder": true,
"encoderAction": {
"$ref": "#value.encoderAction.mfdFms"
}
}
},
{

View file

@ -31,6 +31,7 @@ const getImagePath = (panelInfo) => {
const playSound = (isEnabledSound) => {
if (isEnabledSound) {
let audio = new Audio('/sound/button-click.mp3');
audio.volume = 0.5;
audio.play();
}
}
@ -53,7 +54,6 @@ const execActions = (event, action, simConnectData, showEncoder) => {
actionType: curAction.actionType,
encoderAction: action.encoderAction === undefined ? null : action.encoderAction
}), 200 * i);
if(action.useEncoder)
{
@ -123,7 +123,7 @@ const ImageButton = ({ctrl, panelInfo, showEncoder}) => {
setTimeout(() => { isHighlighted.current = false; }, 2000);
}
if (ctrl.actions != null && ctrl.actions.length > 0)
if (ctrl.action != null)
playSound(isEnabledSound);
if (!isUsedArduino && (ctrl.action.useEncoder || ctrl.action.useDualEncoder))
@ -176,7 +176,7 @@ const BindableImageButton = ({ctrl, panelInfo, showEncoder}) => {
setTimeout(() => { isHighlighted.current = false; }, 2000);
}
if (ctrl.actions != null && ctrl.actions.length > 0)
if (ctrl.action != null)
playSound(isEnabledSound);
if (!isUsedArduino && (ctrl.action.useEncoder || ctrl.action.useDualEncoder))

View file

@ -129,9 +129,9 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
var commandAction = ActionLogicArduino.GetSimConnectCommand(_currentSimConnectEncoderAction, e.InputName, e.InputAction);
if (e.Acceleration == 1)
// do manual arduino joystick acceleration
if (e.Acceleration == 1 && e.InputName == InputName.Joystick)
{
// do manual acceleration
if (_lastCommandAction != null && commandAction.Action == _lastCommandAction.Action)
_repeatCommandActionCount++;
else
@ -149,13 +149,17 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
_actionQueue.Enqueue(commandAction);
}
else
else if (e.Acceleration > 1)
{
for (var a = 0; a < e.Acceleration; a++)
{
_actionQueue.Enqueue(commandAction);
}
}
else
{
_actionQueue.Enqueue(commandAction);
}
}
}

View file

@ -14,6 +14,9 @@ namespace MSFSPopoutPanelManager.UserDataAgent
PanelSourceCoordinates = new ObservableCollection<PanelSourceCoordinate>();
TouchPanelBindings = new ObservableCollection<TouchPanelBinding>();
IsLocked = false;
// Legacy data
BindingAircraftLiveries = new ObservableCollection<string>();
}
public int ProfileId { get; set; }
@ -29,6 +32,10 @@ namespace MSFSPopoutPanelManager.UserDataAgent
public ObservableCollection<TouchPanelBinding> TouchPanelBindings { get; set; }
// Legacy data
[JsonConverter(typeof(SingleValueArrayConvertor<string>))]
public ObservableCollection<string> BindingAircraftLiveries { get; set; }
public bool IsLocked { get; set; }
public bool PowerOnRequiredForColdStart { get; set; }