mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-18 08:13:20 +08:00
fix(地图遮罩): 修复DPI计算句柄选择与小地图遮罩默认禁用
修复DPI计算时未正确使用游戏窗口句柄的问题,改为优先使用游戏窗口句柄 将小地图遮罩和自动记录路径功能默认禁用,避免启动时误显示 在设置页面为地图遮罩功能添加展开面板,并包含小地图遮罩开关
This commit is contained in:
@@ -20,13 +20,13 @@ public partial class MapMaskConfig : ObservableObject
|
||||
/// 小地图遮罩是否启用
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _miniMapMaskEnabled = true;
|
||||
private bool _miniMapMaskEnabled = false;
|
||||
|
||||
/// <summary>
|
||||
/// 自动记录路径功能是否启用
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _pathAutoRecordEnabled = true;
|
||||
private bool _pathAutoRecordEnabled = false;
|
||||
|
||||
private MapPointApiProvider _mapPointApiProvider = MapPointApiProvider.MihoyoMap;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using Vanara.PInvoke;
|
||||
|
||||
namespace BetterGenshinImpact.Helpers;
|
||||
@@ -18,7 +19,16 @@ public class DpiHelper
|
||||
if (Environment.OSVersion.Version >= new Version(6, 3)
|
||||
&& UIDispatcherHelper.MainWindow != null)
|
||||
{
|
||||
HWND hWnd = new WindowInteropHelper(Application.Current?.MainWindow).Handle;
|
||||
HWND hWnd = HWND.NULL;
|
||||
if (TaskContext.Instance().IsInitialized)
|
||||
{
|
||||
hWnd = TaskContext.Instance().GameHandle;
|
||||
}
|
||||
else
|
||||
{
|
||||
hWnd = new WindowInteropHelper(Application.Current?.MainWindow).Handle;
|
||||
}
|
||||
|
||||
HMONITOR hMonitor = User32.MonitorFromWindow(hWnd, User32.MonitorFlags.MONITOR_DEFAULTTONEAREST);
|
||||
SHCore.GetDpiForMonitor(hMonitor, SHCore.MONITOR_DPI_TYPE.MDT_EFFECTIVE_DPI, out _, out uint dpiY);
|
||||
return dpiY / 96f;
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
Grid.ColumnSpan="6"
|
||||
ClipToBounds="True">
|
||||
<controls:MiniMapPointsCanvas x:Name="MiniMapPointsCanvasControl"
|
||||
Visibility="{Binding Config.MapMaskConfig.MiniMapMaskEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
PointsSource="{Binding MapPoints}"
|
||||
LabelsSource="{Binding MapPointLabels}"
|
||||
IsHitTestVisible="False">
|
||||
|
||||
@@ -975,16 +975,20 @@
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
<ui:CardControl Margin="0,0,0,12">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:CardExpander Margin="0,0,0,12" ContentPadding="0">
|
||||
<ui:CardExpander.Icon>
|
||||
<ui:FontIcon Glyph="" Style="{StaticResource FaFontIconStyle}" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
</ui:CardExpander.Icon>
|
||||
<ui:CardExpander.Header>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
@@ -996,10 +1000,41 @@
|
||||
TextWrapping="Wrap">
|
||||
在遮罩窗口中显示大地图位置与标点信息
|
||||
</ui:TextBlock>
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,24,0"
|
||||
IsChecked="{Binding Config.MapMaskConfig.Enabled, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
</ui:CardControl.Header>
|
||||
<ui:ToggleSwitch Margin="0,0,40,0" IsChecked="{Binding Config.MapMaskConfig.Enabled, Mode=TwoWay}" />
|
||||
</ui:CardControl>
|
||||
</ui:CardExpander.Header>
|
||||
<StackPanel IsEnabled="{Binding Config.MapMaskConfig.Enabled}">
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="启用小地图遮罩"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="在小地图上显示点位"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,8,0"
|
||||
IsChecked="{Binding Config.MapMaskConfig.MiniMapMaskEnabled, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
<!-- 冷却提示 -->
|
||||
<ui:CardExpander
|
||||
|
||||
Reference in New Issue
Block a user