mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-15 07:43:20 +08:00
彻底删除 实验功能 遮罩以原神子窗体方式启动 UseSubform
This commit is contained in:
@@ -63,13 +63,6 @@ public partial class MaskWindowConfig : ObservableObject
|
||||
[ObservableProperty]
|
||||
private bool _showFps = false;
|
||||
|
||||
/// <summary>
|
||||
/// 作为原神子窗体
|
||||
/// 有些bug没解决
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _useSubform = false;
|
||||
|
||||
/// <summary>
|
||||
/// 遮罩文本透明度 (0.0-1.0)
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using BetterGenshinImpact.View;
|
||||
@@ -259,14 +259,11 @@ namespace BetterGenshinImpact.GameTask
|
||||
Debug.WriteLine("游戏窗口不在前台, 不再进行截屏");
|
||||
}
|
||||
|
||||
if (!TaskContext.Instance().Config.MaskWindowConfig.UseSubform)
|
||||
var pName = SystemControl.GetActiveProcessName();
|
||||
if (pName != "Idle" && pName != "BetterGI" && pName != "YuanShen" && pName != "GenshinImpact" && pName != "Genshin Impact Cloud Game")
|
||||
{
|
||||
var pName = SystemControl.GetActiveProcessName();
|
||||
if (pName != "Idle" && pName != "BetterGI" && pName != "YuanShen" && pName != "GenshinImpact" && pName != "Genshin Impact Cloud Game")
|
||||
{
|
||||
// Debug.WriteLine(pName + ":hide mask window");
|
||||
maskWindow.Invoke(() => { maskWindow.HideSelf(); });
|
||||
}
|
||||
// Debug.WriteLine(pName + ":hide mask window");
|
||||
maskWindow.Invoke(() => { maskWindow.HideSelf(); });
|
||||
}
|
||||
|
||||
_prevGameActive = active;
|
||||
@@ -302,23 +299,20 @@ namespace BetterGenshinImpact.GameTask
|
||||
else
|
||||
{
|
||||
PictureInPictureService.Hide(resetManual: true);
|
||||
if (!TaskContext.Instance().Config.MaskWindowConfig.UseSubform)
|
||||
// if (!_prevGameActive)
|
||||
// {
|
||||
maskWindow.Invoke(() =>
|
||||
{
|
||||
// if (!_prevGameActive)
|
||||
// {
|
||||
maskWindow.Invoke(() =>
|
||||
if (maskWindow.IsExist())
|
||||
{
|
||||
if (maskWindow.IsExist())
|
||||
maskWindow.Show();
|
||||
if (!_prevGameActive)
|
||||
{
|
||||
maskWindow.Show();
|
||||
if (!_prevGameActive)
|
||||
{
|
||||
maskWindow.BringToTop();
|
||||
}
|
||||
maskWindow.BringToTop();
|
||||
}
|
||||
});
|
||||
// }
|
||||
}
|
||||
}
|
||||
});
|
||||
// }
|
||||
|
||||
_prevGameActive = active;
|
||||
// // 移动游戏窗口的时候同步遮罩窗口的位置,此时不进行捕获
|
||||
@@ -528,4 +522,4 @@ namespace BetterGenshinImpact.GameTask
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ public partial class MaskWindow : Window
|
||||
private static readonly Typeface _typeface;
|
||||
private static readonly Typeface _fgiTypeface;
|
||||
|
||||
private nint _hWnd;
|
||||
private MaskWindowViewModel? _viewModel;
|
||||
|
||||
private IRichTextBox? _richTextBox;
|
||||
@@ -104,14 +103,7 @@ public partial class MaskWindow : Window
|
||||
|
||||
public void RefreshPosition()
|
||||
{
|
||||
if (TaskContext.Instance().Config.MaskWindowConfig.UseSubform)
|
||||
{
|
||||
RefreshPositionForSubform();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshPositionForNormal();
|
||||
}
|
||||
RefreshPositionForNormal();
|
||||
}
|
||||
|
||||
public void RefreshPositionForNormal()
|
||||
@@ -130,13 +122,6 @@ public partial class MaskWindow : Window
|
||||
});
|
||||
}
|
||||
|
||||
public void RefreshPositionForSubform()
|
||||
{
|
||||
nint targetHWnd = TaskContext.Instance().GameHandle;
|
||||
_ = User32.GetClientRect(targetHWnd, out RECT targetRect);
|
||||
_ = User32.SetWindowPos(_hWnd, IntPtr.Zero, 0, 0, targetRect.Width, targetRect.Height, User32.SetWindowPosFlags.SWP_SHOWWINDOW);
|
||||
}
|
||||
|
||||
public MaskWindow()
|
||||
{
|
||||
_maskWindow = this;
|
||||
@@ -204,17 +189,6 @@ public partial class MaskWindow : Window
|
||||
|
||||
UpdateClickThroughState();
|
||||
|
||||
if (TaskContext.Instance().Config.MaskWindowConfig.UseSubform)
|
||||
{
|
||||
_hWnd = new WindowInteropHelper(this).Handle;
|
||||
nint targetHWnd = TaskContext.Instance().GameHandle;
|
||||
|
||||
if (User32.GetParent(_hWnd) != targetHWnd)
|
||||
{
|
||||
_ = User32.SetParent(_hWnd, targetHWnd);
|
||||
}
|
||||
}
|
||||
|
||||
RefreshPosition();
|
||||
PrintSystemInfo();
|
||||
if (_viewModel != null)
|
||||
|
||||
@@ -449,33 +449,6 @@
|
||||
FontSize="14"
|
||||
Text="{Binding Config.MaskWindowConfig.TextOpacity, StringFormat=F2}" />
|
||||
</Grid>
|
||||
|
||||
|
||||
<!--<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="遮罩能够完全跟随窗体移动,但存在一些BUG,此配置重启后生效"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
IsChecked="{Binding Config.MaskWindowConfig.UseSubform, Mode=TwoWay}" />
|
||||
</Grid>-->
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user