mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-11-21 21:30:12 +00:00
Started development v3.4.2
This commit is contained in:
parent
ea098e9033
commit
c16b3fefaf
9 changed files with 52 additions and 13 deletions
|
@ -10,6 +10,8 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
|
|
||||||
public string CurrentMsfsAircraft { get; set; }
|
public string CurrentMsfsAircraft { get; set; }
|
||||||
|
|
||||||
|
public string CurrentMsfsLiveryTitle { get; set; }
|
||||||
|
|
||||||
public bool HasCurrentMsfsAircraft
|
public bool HasCurrentMsfsAircraft
|
||||||
{
|
{
|
||||||
get { return !String.IsNullOrEmpty(CurrentMsfsAircraft); }
|
get { return !String.IsNullOrEmpty(CurrentMsfsAircraft); }
|
||||||
|
@ -35,6 +37,7 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
public void ClearData()
|
public void ClearData()
|
||||||
{
|
{
|
||||||
CurrentMsfsAircraft = null;
|
CurrentMsfsAircraft = null;
|
||||||
|
CurrentMsfsLiveryTitle = null;
|
||||||
ElectricalMasterBatteryStatus = false;
|
ElectricalMasterBatteryStatus = false;
|
||||||
IsEnteredFlight = false;
|
IsEnteredFlight = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,16 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
var aircraftName = Convert.ToString(e.Find(d => d.PropName == "AircraftName").Value);
|
var aircraftName = Convert.ToString(e.Find(d => d.PropName == "AircraftName").Value);
|
||||||
aircraftName = String.IsNullOrEmpty(aircraftName) ? null : aircraftName;
|
aircraftName = String.IsNullOrEmpty(aircraftName) ? null : aircraftName;
|
||||||
var electricalMasterBattery = Convert.ToBoolean(e.Find(d => d.PropName == "ElectricalMasterBattery").Value);
|
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
|
// Automatic switching of active profile when SimConnect active aircraft change
|
||||||
if (FlightSimData.CurrentMsfsAircraft != aircraftName)
|
if (FlightSimData.CurrentMsfsAircraft != aircraftName)
|
||||||
|
@ -53,9 +63,6 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
FlightSimData.CurrentMsfsAircraft = aircraftName;
|
FlightSimData.CurrentMsfsAircraft = aircraftName;
|
||||||
ProfileData.AutoSwitchProfile(aircraftName);
|
ProfileData.AutoSwitchProfile(aircraftName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (electricalMasterBattery != FlightSimData.ElectricalMasterBatteryStatus)
|
|
||||||
FlightSimData.ElectricalMasterBatteryStatus = electricalMasterBattery;
|
|
||||||
};
|
};
|
||||||
_simConnectProvider.OnFlightStarted += (sender, e) => OnFlightStarted?.Invoke(this, null);
|
_simConnectProvider.OnFlightStarted += (sender, e) => OnFlightStarted?.Invoke(this, null);
|
||||||
_simConnectProvider.OnFlightStopped += HandleOnFlightStopped;
|
_simConnectProvider.OnFlightStopped += HandleOnFlightStopped;
|
||||||
|
|
|
@ -231,7 +231,7 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
{
|
{
|
||||||
case PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND:
|
case PInvokeConstant.EVENT_SYSTEM_MOVESIZEEND:
|
||||||
// Move window back to original location
|
// 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;
|
break;
|
||||||
case PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE:
|
case PInvokeConstant.EVENT_OBJECT_LOCATIONCHANGE:
|
||||||
// Detect if window is maximized, if so, save settings
|
// Detect if window is maximized, if so, save settings
|
||||||
|
|
|
@ -170,5 +170,20 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
UpdateActiveProfile(matchedProfile.ProfileId);
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,8 @@
|
||||||
"width": 1408,
|
"width": 1408,
|
||||||
"height": 914
|
"height": 914
|
||||||
},
|
},
|
||||||
"showMenuBar": false,
|
"showMenuBar": true,
|
||||||
"enableMap": false,
|
"enableMap": true,
|
||||||
"subPanels": [
|
"subPanels": [
|
||||||
{
|
{
|
||||||
"panelId": "pfd",
|
"panelId": "pfd",
|
||||||
|
|
|
@ -351,7 +351,10 @@
|
||||||
"actionType": "EncoderAction"
|
"actionType": "EncoderAction"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"useDualEncoder": true
|
"useDualEncoder": true,
|
||||||
|
"encoderAction": {
|
||||||
|
"$ref": "#value.encoderAction.mfdFms"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,7 @@ const getImagePath = (panelInfo) => {
|
||||||
const playSound = (isEnabledSound) => {
|
const playSound = (isEnabledSound) => {
|
||||||
if (isEnabledSound) {
|
if (isEnabledSound) {
|
||||||
let audio = new Audio('/sound/button-click.mp3');
|
let audio = new Audio('/sound/button-click.mp3');
|
||||||
|
audio.volume = 0.5;
|
||||||
audio.play();
|
audio.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +54,6 @@ const execActions = (event, action, simConnectData, showEncoder) => {
|
||||||
actionType: curAction.actionType,
|
actionType: curAction.actionType,
|
||||||
encoderAction: action.encoderAction === undefined ? null : action.encoderAction
|
encoderAction: action.encoderAction === undefined ? null : action.encoderAction
|
||||||
}), 200 * i);
|
}), 200 * i);
|
||||||
|
|
||||||
|
|
||||||
if(action.useEncoder)
|
if(action.useEncoder)
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ const ImageButton = ({ctrl, panelInfo, showEncoder}) => {
|
||||||
setTimeout(() => { isHighlighted.current = false; }, 2000);
|
setTimeout(() => { isHighlighted.current = false; }, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctrl.actions != null && ctrl.actions.length > 0)
|
if (ctrl.action != null)
|
||||||
playSound(isEnabledSound);
|
playSound(isEnabledSound);
|
||||||
|
|
||||||
if (!isUsedArduino && (ctrl.action.useEncoder || ctrl.action.useDualEncoder))
|
if (!isUsedArduino && (ctrl.action.useEncoder || ctrl.action.useDualEncoder))
|
||||||
|
@ -176,7 +176,7 @@ const BindableImageButton = ({ctrl, panelInfo, showEncoder}) => {
|
||||||
setTimeout(() => { isHighlighted.current = false; }, 2000);
|
setTimeout(() => { isHighlighted.current = false; }, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctrl.actions != null && ctrl.actions.length > 0)
|
if (ctrl.action != null)
|
||||||
playSound(isEnabledSound);
|
playSound(isEnabledSound);
|
||||||
|
|
||||||
if (!isUsedArduino && (ctrl.action.useEncoder || ctrl.action.useDualEncoder))
|
if (!isUsedArduino && (ctrl.action.useEncoder || ctrl.action.useDualEncoder))
|
||||||
|
|
|
@ -129,9 +129,9 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
|
||||||
|
|
||||||
var commandAction = ActionLogicArduino.GetSimConnectCommand(_currentSimConnectEncoderAction, e.InputName, e.InputAction);
|
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)
|
if (_lastCommandAction != null && commandAction.Action == _lastCommandAction.Action)
|
||||||
_repeatCommandActionCount++;
|
_repeatCommandActionCount++;
|
||||||
else
|
else
|
||||||
|
@ -149,13 +149,17 @@ namespace MSFSPopoutPanelManager.SimConnectAgent.TouchPanel
|
||||||
|
|
||||||
_actionQueue.Enqueue(commandAction);
|
_actionQueue.Enqueue(commandAction);
|
||||||
}
|
}
|
||||||
else
|
else if (e.Acceleration > 1)
|
||||||
{
|
{
|
||||||
for (var a = 0; a < e.Acceleration; a++)
|
for (var a = 0; a < e.Acceleration; a++)
|
||||||
{
|
{
|
||||||
_actionQueue.Enqueue(commandAction);
|
_actionQueue.Enqueue(commandAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_actionQueue.Enqueue(commandAction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@ namespace MSFSPopoutPanelManager.UserDataAgent
|
||||||
PanelSourceCoordinates = new ObservableCollection<PanelSourceCoordinate>();
|
PanelSourceCoordinates = new ObservableCollection<PanelSourceCoordinate>();
|
||||||
TouchPanelBindings = new ObservableCollection<TouchPanelBinding>();
|
TouchPanelBindings = new ObservableCollection<TouchPanelBinding>();
|
||||||
IsLocked = false;
|
IsLocked = false;
|
||||||
|
|
||||||
|
// Legacy data
|
||||||
|
BindingAircraftLiveries = new ObservableCollection<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ProfileId { get; set; }
|
public int ProfileId { get; set; }
|
||||||
|
@ -29,6 +32,10 @@ namespace MSFSPopoutPanelManager.UserDataAgent
|
||||||
|
|
||||||
public ObservableCollection<TouchPanelBinding> TouchPanelBindings { get; set; }
|
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 IsLocked { get; set; }
|
||||||
|
|
||||||
public bool PowerOnRequiredForColdStart { get; set; }
|
public bool PowerOnRequiredForColdStart { get; set; }
|
||||||
|
|
Loading…
Reference in a new issue