From b8e5c179fc318bc4baac0ef9cafebc6a0bf658d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89=E9=B8=AD=E8=9B=8B?= Date: Fri, 24 May 2024 12:13:51 +0800 Subject: [PATCH] fix the performance of mask windows at different resolutions - 0.30.1 --- BetterGenshinImpact/Core/Config/Global.cs | 2 +- .../Core/Config/MaskWindowConfig.cs | 5 +++++ .../ViewModel/MaskWindowViewModel.cs | 14 +++++++------- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/BetterGenshinImpact/Core/Config/Global.cs b/BetterGenshinImpact/Core/Config/Global.cs index cd7f4cf9..11dee62e 100644 --- a/BetterGenshinImpact/Core/Config/Global.cs +++ b/BetterGenshinImpact/Core/Config/Global.cs @@ -5,7 +5,7 @@ namespace BetterGenshinImpact.Core.Config; public class Global { - public static string Version { get; } = "0.30.0"; + public static string Version { get; } = "0.30.1"; public static string StartUpPath { get; set; } = AppContext.BaseDirectory; diff --git a/BetterGenshinImpact/Core/Config/MaskWindowConfig.cs b/BetterGenshinImpact/Core/Config/MaskWindowConfig.cs index 904491c4..f0c6b4af 100644 --- a/BetterGenshinImpact/Core/Config/MaskWindowConfig.cs +++ b/BetterGenshinImpact/Core/Config/MaskWindowConfig.cs @@ -69,6 +69,11 @@ public partial class MaskWindowConfig : ObservableObject /// public Rect UidCoverRect { get; set; } = new(1690, 1052, 173, 22); + /// + /// 1080p下UID遮盖的位置与大小 + /// + public Rect UidCoverRightBottomRect { get; set; } = new(1920 - 1690, 1080 - 1052, 173, 22); + public Point EastPoint { get; set; } = new(274, 109); public Point SouthPoint { get; set; } = new(150, 233); public Point WestPoint { get; set; } = new(32, 109); diff --git a/BetterGenshinImpact/ViewModel/MaskWindowViewModel.cs b/BetterGenshinImpact/ViewModel/MaskWindowViewModel.cs index 266b158b..5cf5e6f7 100644 --- a/BetterGenshinImpact/ViewModel/MaskWindowViewModel.cs +++ b/BetterGenshinImpact/ViewModel/MaskWindowViewModel.cs @@ -30,7 +30,6 @@ namespace BetterGenshinImpact.ViewModel [ObservableProperty] private Point _westPoint = new(32, 109); [ObservableProperty] private Point _northPoint = new(150, -9); - public MaskWindowViewModel() { WeakReferenceMessenger.Default.Register>(this, (sender, msg) => @@ -98,12 +97,13 @@ namespace BetterGenshinImpact.ViewModel // 比较特殊,必须要启动过任务调度器才能够获取到缩放信息 if (TaskContext.Instance().SystemInfo != null) { - var assetScale = TaskContext.Instance().SystemInfo.AssetScale; + var captureRect = TaskContext.Instance().SystemInfo.CaptureAreaRect; + var assetScale = TaskContext.Instance().SystemInfo.ScaleTo1080PRatio; var dpiScale = TaskContext.Instance().DpiScale; - UidCoverRect = new Rect(Config.MaskWindowConfig.UidCoverRect.X * assetScale / dpiScale, - Config.MaskWindowConfig.UidCoverRect.Y * assetScale / dpiScale, - Config.MaskWindowConfig.UidCoverRect.Width * assetScale / dpiScale, - Config.MaskWindowConfig.UidCoverRect.Height * assetScale / dpiScale); + UidCoverRect = new Rect((captureRect.Width - Config.MaskWindowConfig.UidCoverRightBottomRect.X * assetScale) / dpiScale, + (captureRect.Height - Config.MaskWindowConfig.UidCoverRightBottomRect.Y * assetScale) / dpiScale, + Config.MaskWindowConfig.UidCoverRightBottomRect.Width * assetScale / dpiScale, + Config.MaskWindowConfig.UidCoverRightBottomRect.Height * assetScale / dpiScale); EastPoint = new Point(Config.MaskWindowConfig.EastPoint.X * assetScale / dpiScale, Config.MaskWindowConfig.EastPoint.Y * assetScale / dpiScale); SouthPoint = new Point(Config.MaskWindowConfig.SouthPoint.X * assetScale / dpiScale, @@ -131,4 +131,4 @@ namespace BetterGenshinImpact.ViewModel } } } -} \ No newline at end of file +}