mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-15 07:43:20 +08:00
地图遮罩开关实时生效
This commit is contained in:
@@ -44,6 +44,21 @@ public class MapMaskTrigger : ITaskTrigger
|
||||
public void Init()
|
||||
{
|
||||
IsEnabled = _config.Enabled;
|
||||
|
||||
// 关闭时隐藏UI
|
||||
if (!IsEnabled)
|
||||
{
|
||||
UIDispatcherHelper.Invoke(() =>
|
||||
{
|
||||
if (MaskWindow.InstanceNullable() != null)
|
||||
{
|
||||
if (MaskWindow.Instance().DataContext is MaskWindowViewModel vm)
|
||||
{
|
||||
vm.IsInBigMapUi = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void OnCapture(CaptureContent content)
|
||||
@@ -61,8 +76,7 @@ public class MapMaskTrigger : ITaskTrigger
|
||||
var inBigMapUi = content.CurrentGameUiCategory == GameUiCategory.BigMap || Bv.IsInBigMapUi(region);
|
||||
UIDispatcherHelper.Invoke(() =>
|
||||
{
|
||||
var vm = MaskWindow.Instance().DataContext as MaskWindowViewModel;
|
||||
if (vm != null)
|
||||
if (MaskWindow.Instance().DataContext is MaskWindowViewModel vm)
|
||||
{
|
||||
vm.IsInBigMapUi = inBigMapUi;
|
||||
}
|
||||
|
||||
@@ -77,6 +77,11 @@ public partial class MaskWindow : Window
|
||||
return _maskWindow;
|
||||
}
|
||||
|
||||
public static MaskWindow? InstanceNullable()
|
||||
{
|
||||
return _maskWindow;
|
||||
}
|
||||
|
||||
public bool IsExist()
|
||||
{
|
||||
return _maskWindow != null && PresentationSource.FromVisual(_maskWindow) != null;
|
||||
@@ -593,23 +598,7 @@ file static class MaskWindowExtension
|
||||
|
||||
public static void SetClickThrough(this Window window, bool isClickThrough)
|
||||
{
|
||||
SetClickThrough(new WindowInteropHelper(window).Handle, isClickThrough);
|
||||
}
|
||||
|
||||
private static void SetClickThrough(nint hWnd, bool isClickThrough)
|
||||
{
|
||||
int style = User32.GetWindowLong(hWnd, User32.WindowLongFlags.GWL_EXSTYLE);
|
||||
|
||||
if (isClickThrough)
|
||||
{
|
||||
style |= (int)User32.WindowStylesEx.WS_EX_TRANSPARENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
style &= ~(int)User32.WindowStylesEx.WS_EX_TRANSPARENT;
|
||||
}
|
||||
|
||||
_ = User32.SetWindowLong(hWnd, User32.WindowLongFlags.GWL_EXSTYLE, style);
|
||||
SetLayeredWindow(new WindowInteropHelper(window).Handle, isClickThrough);
|
||||
}
|
||||
|
||||
public static void SetChildWindow(this Window window)
|
||||
|
||||
Reference in New Issue
Block a user