mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-11-24 06:40:09 +00:00
Update camera view logic
This commit is contained in:
parent
5983ff749d
commit
1999a5c84f
6 changed files with 64 additions and 8 deletions
|
@ -7,8 +7,11 @@ namespace MSFSPopoutPanelManager.DomainModel.Setting
|
||||||
public AutoPopOutSetting()
|
public AutoPopOutSetting()
|
||||||
{
|
{
|
||||||
IsEnabled = true;
|
IsEnabled = true;
|
||||||
|
ReadyToFlyDelay = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsEnabled { get; set; }
|
public bool IsEnabled { get; set; }
|
||||||
|
|
||||||
|
public int ReadyToFlyDelay { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,6 +218,30 @@
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
<WrapPanel Margin="0,0,20,20" Orientation="Vertical">
|
||||||
|
<TextBlock Style="{StaticResource TextBlockHeading}">Ready to Fly Button Delay</TextBlock>
|
||||||
|
<Line
|
||||||
|
Stretch="Fill"
|
||||||
|
Stroke="Gray"
|
||||||
|
X2="1" />
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<localcontrol:NumericUpDown
|
||||||
|
Width="90"
|
||||||
|
Height="24"
|
||||||
|
FontSize="12"
|
||||||
|
Increment="1"
|
||||||
|
MaxValue="10"
|
||||||
|
MinValue="0"
|
||||||
|
Value="{Binding AppSettingData.ApplicationSetting.AutoPopOutSetting.ReadyToFlyDelay, Mode=TwoWay}" />
|
||||||
|
<TextBlock
|
||||||
|
Width="640"
|
||||||
|
Margin="10,0,0,0"
|
||||||
|
Style="{StaticResource TextBlockLabel}"
|
||||||
|
TextWrapping="Wrap">
|
||||||
|
Amount of time in seconds to delay auto pop out panels from starting after ready to fly button has been pressed automatically. Extending this delay helps resolve auto pop out failure because cockpit has not been loaded completely yet on slower PC.
|
||||||
|
</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</WrapPanel>
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
|
|
||||||
<!-- Pop Out Settings -->
|
<!-- Pop Out Settings -->
|
||||||
|
|
|
@ -8,12 +8,14 @@ using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
|
||||||
|
|
||||||
namespace MSFSPopoutPanelManager.Orchestration
|
namespace MSFSPopoutPanelManager.Orchestration
|
||||||
{
|
{
|
||||||
public class PanelPopOutOrchestrator : ObservableObject
|
public class PanelPopOutOrchestrator : ObservableObject
|
||||||
{
|
{
|
||||||
|
// This will be replaced by a signal from Ready to Fly Skipper into webserver in version 4.0
|
||||||
|
private const int READY_TO_FLY_BUTTON_APPEARANCE_DELAY = 2000;
|
||||||
|
|
||||||
private ProfileData _profileData;
|
private ProfileData _profileData;
|
||||||
private AppSettingData _appSettingData;
|
private AppSettingData _appSettingData;
|
||||||
private FlightSimData _flightSimData;
|
private FlightSimData _flightSimData;
|
||||||
|
@ -74,6 +76,8 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
await StepReadyToFlyDelay(true);
|
||||||
|
|
||||||
await CoreSteps(true);
|
await CoreSteps(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -123,6 +127,28 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
PanelSourceOrchestrator.CloseAllPanelSource();
|
PanelSourceOrchestrator.CloseAllPanelSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task StepReadyToFlyDelay(bool isAutoPopOut)
|
||||||
|
{
|
||||||
|
if (!isAutoPopOut)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (AppSetting.AutoPopOutSetting.ReadyToFlyDelay == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
WorkflowStepWithMessage.Execute("Waiting on ready to fly button delay", () =>
|
||||||
|
{
|
||||||
|
// Ready to fly button plugin default delay
|
||||||
|
Thread.Sleep(READY_TO_FLY_BUTTON_APPEARANCE_DELAY);
|
||||||
|
|
||||||
|
// Extra wait for cockpit view to appear and align
|
||||||
|
Thread.Sleep(AppSetting.AutoPopOutSetting.ReadyToFlyDelay * 1000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task StepAddCutomPanels(List<IntPtr> builtInPanelHandles)
|
private async Task StepAddCutomPanels(List<IntPtr> builtInPanelHandles)
|
||||||
{
|
{
|
||||||
if (!ActiveProfile.HasCustomPanels)
|
if (!ActiveProfile.HasCustomPanels)
|
||||||
|
@ -158,9 +184,11 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
|
|
||||||
// Turn off TrackIR if TrackIR is started
|
// Turn off TrackIR if TrackIR is started
|
||||||
FlightSimOrchestrator.TurnOffTrackIR();
|
FlightSimOrchestrator.TurnOffTrackIR();
|
||||||
|
Thread.Sleep(500);
|
||||||
|
|
||||||
// Turn on Active Pause
|
// Turn on Active Pause
|
||||||
FlightSimOrchestrator.TurnOnActivePause();
|
FlightSimOrchestrator.TurnOnActivePause();
|
||||||
|
Thread.Sleep(500);
|
||||||
|
|
||||||
// Setting custom camera angle for auto panning
|
// Setting custom camera angle for auto panning
|
||||||
if (AppSetting.PopOutSetting.AutoPanning.IsEnabled)
|
if (AppSetting.PopOutSetting.AutoPanning.IsEnabled)
|
||||||
|
@ -182,7 +210,6 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
Thread.Sleep(2000);
|
Thread.Sleep(2000);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
|
||||||
WorkflowStepWithMessage.Execute("Setting camera zoom level", () =>
|
WorkflowStepWithMessage.Execute("Setting camera zoom level", () =>
|
||||||
{
|
{
|
||||||
SetCockpitZoomLevel(50);
|
SetCockpitZoomLevel(50);
|
||||||
|
@ -241,9 +268,11 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
|
|
||||||
// Turn TrackIR back on
|
// Turn TrackIR back on
|
||||||
FlightSimOrchestrator.TurnOnTrackIR();
|
FlightSimOrchestrator.TurnOnTrackIR();
|
||||||
|
Thread.Sleep(500);
|
||||||
|
|
||||||
// Turn on Active Pause
|
// Turn on Active Pause
|
||||||
FlightSimOrchestrator.TurnOffActivePause();
|
FlightSimOrchestrator.TurnOffActivePause();
|
||||||
|
Thread.Sleep(500);
|
||||||
|
|
||||||
// Return to custom camera view if set
|
// Return to custom camera view if set
|
||||||
ReturnToAfterPopOutCameraView();
|
ReturnToAfterPopOutCameraView();
|
||||||
|
|
|
@ -88,6 +88,9 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
// Save last auto panning camera angle
|
// Save last auto panning camera angle
|
||||||
if (AppSetting.PopOutSetting.AutoPanning.IsEnabled)
|
if (AppSetting.PopOutSetting.AutoPanning.IsEnabled)
|
||||||
{
|
{
|
||||||
|
// !!! Fix MSFS bug that without setting zoom, everything will be off by few pixels
|
||||||
|
FlightSimOrchestrator.SetCockpitCameraZoomLevel(_flightSimData.CockpitCameraZoom);
|
||||||
|
|
||||||
// If using windows mode, save MSFS game window configuration
|
// If using windows mode, save MSFS game window configuration
|
||||||
if (_appSettingData.ApplicationSetting.WindowedModeSetting.AutoResizeMsfsGameWindow)
|
if (_appSettingData.ApplicationSetting.WindowedModeSetting.AutoResizeMsfsGameWindow)
|
||||||
_profileData.SaveMsfsGameWindowConfig();
|
_profileData.SaveMsfsGameWindowConfig();
|
||||||
|
@ -103,7 +106,6 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
if (!AppSetting.PopOutSetting.AfterPopOutCameraView.IsEnabled)
|
if (!AppSetting.PopOutSetting.AfterPopOutCameraView.IsEnabled)
|
||||||
{
|
{
|
||||||
FlightSimOrchestrator.ResetCameraView();
|
FlightSimOrchestrator.ResetCameraView();
|
||||||
Thread.Sleep(500);
|
|
||||||
SetCockpitZoomLevel(_prePanelConfigurationCockpitZoomLevel);
|
SetCockpitZoomLevel(_prePanelConfigurationCockpitZoomLevel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -112,7 +114,6 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
{
|
{
|
||||||
case AfterPopOutCameraViewType.CockpitCenterView:
|
case AfterPopOutCameraViewType.CockpitCenterView:
|
||||||
FlightSimOrchestrator.ResetCameraView();
|
FlightSimOrchestrator.ResetCameraView();
|
||||||
Thread.Sleep(500);
|
|
||||||
SetCockpitZoomLevel(_prePanelConfigurationCockpitZoomLevel);
|
SetCockpitZoomLevel(_prePanelConfigurationCockpitZoomLevel);
|
||||||
break;
|
break;
|
||||||
case AfterPopOutCameraViewType.CustomCameraView:
|
case AfterPopOutCameraViewType.CustomCameraView:
|
||||||
|
@ -179,7 +180,6 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
{
|
{
|
||||||
// Disable hooks if active
|
// Disable hooks if active
|
||||||
InputHookManager.EndMouseHook();
|
InputHookManager.EndMouseHook();
|
||||||
//InputHookManager.EndKeyboardHook();
|
|
||||||
|
|
||||||
_profileData.ActiveProfile.CurrentMoveResizePanelId = Guid.Empty;
|
_profileData.ActiveProfile.CurrentMoveResizePanelId = Guid.Empty;
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
for (var i = 0; i < retry; i++)
|
for (var i = 0; i < retry; i++)
|
||||||
{
|
{
|
||||||
FlightSimOrchestrator.SetCockpitCameraZoomLevel(zoom);
|
FlightSimOrchestrator.SetCockpitCameraZoomLevel(zoom);
|
||||||
Thread.Sleep(500); // wait for flightsimdata to be updated
|
Thread.Sleep(750); // wait for flightsimdata to be updated
|
||||||
|
|
||||||
if (_flightSimData.CockpitCameraZoom == zoom)
|
if (_flightSimData.CockpitCameraZoom == zoom)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
## Version 4.0.2
|
## Version 4.0.2
|
||||||
* Added new logic to detect when flight session is ready to initiate pop out process for auto pop out panel. Ready to Fly button delay setting is no longer needed.
|
* Added new logic to detect when flight session is ready to initiate pop out process for auto pop out panel.
|
||||||
|
|
||||||
* Updated logic to load custom camera view when performing pop out. The new logic is more reliable but unfornately will be a little slower because MSFS AAU2 may have introduced issue in loading and saving camera view. Pop out progress messages will show steps being taken when adjusting camera view.
|
* Updated logic to load custom camera view when performing pop out. The new logic is more reliable but unfornately will be a little slower because MSFS AAU2 may have introduced issue in loading and saving camera view. Pop out progress messages will show steps being taken when adjusting camera view.
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
## Version 4.0.2
|
## Version 4.0.2
|
||||||
* Added new logic to detect when flight session is ready to initiate pop out process for auto pop out panel. Ready to Fly button delay setting is no longer needed.
|
* Added new logic to detect when flight session is ready to initiate pop out process for auto pop out panel.
|
||||||
|
|
||||||
* Updated logic to load custom camera view when performing pop out. The new logic is more reliable but unfornately will be a little slower because MSFS AAU2 may have introduced issue in loading and saving camera view. Pop out progress messages will show steps being taken when adjusting camera view.
|
* Updated logic to load custom camera view when performing pop out. The new logic is more reliable but unfornately will be a little slower because MSFS AAU2 may have introduced issue in loading and saving camera view. Pop out progress messages will show steps being taken when adjusting camera view.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue