mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-30 10:19:51 +08:00
optimize
This commit is contained in:
@@ -63,7 +63,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="GameTask\TaskContext.cs">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="View\MaskWindow.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.AutoDomain;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
using BetterGenshinImpact.GameTask.AutoFishing;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation;
|
||||
using BetterGenshinImpact.GameTask.AutoPick;
|
||||
using BetterGenshinImpact.GameTask.AutoSkip;
|
||||
using BetterGenshinImpact.GameTask.AutoWood;
|
||||
using BetterGenshinImpact.GameTask.QuickTeleport;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Fischless.GameCapture;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text.Json.Serialization;
|
||||
using BetterGenshinImpact.GameTask.AutoDomain;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
using BetterGenshinImpact.Model;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation;
|
||||
using BetterGenshinImpact.GameTask.AutoWood;
|
||||
using BetterGenshinImpact.GameTask.QuickTeleport;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace BetterGenshinImpact.Core.Config
|
||||
/// <summary>
|
||||
/// 1080p下UID遮盖的位置与大小
|
||||
/// </summary>
|
||||
public Rect UidCoverRect { get; set; } = new(1695, 1052, 168, 22);
|
||||
public Rect UidCoverRect { get; set; } = new(1690, 1052, 173, 22);
|
||||
|
||||
/// <summary>
|
||||
/// 方位提示是否启用
|
||||
|
||||
@@ -58,12 +58,14 @@ public class AutoSkipAssets
|
||||
DrawOnWindow = true
|
||||
}.InitTemplate();
|
||||
|
||||
|
||||
var optionRect = new Rect(info.CaptureAreaRect.Width / 2, 0, info.CaptureAreaRect.Width - info.CaptureAreaRect.Width / 2 - info.CaptureAreaRect.Width / 6, info.CaptureAreaRect.Height);
|
||||
OptionIconRo = new RecognitionObject
|
||||
{
|
||||
Name = "OptionIcon",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoSkip", "icon_option.png"),
|
||||
RegionOfInterest = new Rect(info.CaptureAreaRect.Width / 2, 0, info.CaptureAreaRect.Width - info.CaptureAreaRect.Width / 2, info.CaptureAreaRect.Height),
|
||||
RegionOfInterest = optionRect,
|
||||
DrawOnWindow = false
|
||||
}.InitTemplate();
|
||||
DailyRewardIconRo = new RecognitionObject
|
||||
@@ -71,7 +73,7 @@ public class AutoSkipAssets
|
||||
Name = "DailyRewardIcon",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoSkip", "icon_daily_reward.png"),
|
||||
RegionOfInterest = new Rect(info.CaptureAreaRect.Width / 2, 0, info.CaptureAreaRect.Width - info.CaptureAreaRect.Width / 2, info.CaptureAreaRect.Height),
|
||||
RegionOfInterest = optionRect,
|
||||
DrawOnWindow = false
|
||||
}.InitTemplate();
|
||||
ExploreIconRo = new RecognitionObject
|
||||
@@ -79,7 +81,7 @@ public class AutoSkipAssets
|
||||
Name = "ExploreIcon",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoSkip", "icon_explore.png"),
|
||||
RegionOfInterest = new Rect(info.CaptureAreaRect.Width / 2, 0, info.CaptureAreaRect.Width - info.CaptureAreaRect.Width / 2, info.CaptureAreaRect.Height),
|
||||
RegionOfInterest = optionRect,
|
||||
DrawOnWindow = false
|
||||
}.InitTemplate();
|
||||
|
||||
|
||||
@@ -20,7 +20,10 @@ using BetterGenshinImpact.Core.Config;
|
||||
using Vanara.PInvoke;
|
||||
using System.IO;
|
||||
using System.Drawing.Imaging;
|
||||
using OpenCvSharp;
|
||||
using OpenCvSharp.Extensions;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar;
|
||||
using Point = OpenCvSharp.Point;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask
|
||||
{
|
||||
@@ -426,7 +429,18 @@ namespace BetterGenshinImpact.GameTask
|
||||
var name = $@"{DateTime.Now:yyyyMMddHHmmssffff}.png";
|
||||
var savePath = Global.Absolute($@"log\screenshot\{name}");
|
||||
|
||||
bitmap.Save(savePath, ImageFormat.Png);
|
||||
if (TaskContext.Instance().Config.CommonConfig.ScreenshotUidCoverEnabled)
|
||||
{
|
||||
var mat = bitmap.ToMat();
|
||||
var rect = TaskContext.Instance().Config.MaskWindowConfig.UidCoverRect;
|
||||
mat.Rectangle(rect, Scalar.White, -1);
|
||||
Cv2.ImWrite(savePath, mat);
|
||||
}
|
||||
else
|
||||
{
|
||||
bitmap.Save(savePath, ImageFormat.Png);
|
||||
}
|
||||
|
||||
_logger.LogInformation("截图已保存: {Name}", name);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -6,6 +6,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using BetterGenshinImpact.Helpers.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using HotKeySettingModel = BetterGenshinImpact.Model.HotKeySettingModel;
|
||||
@@ -182,7 +183,7 @@ public partial class HotKeyPageViewModel : ObservableObject
|
||||
nameof(Config.HotKeyConfig.QuickTeleportTickHotkey),
|
||||
Config.HotKeyConfig.QuickTeleportTickHotkey,
|
||||
Config.HotKeyConfig.QuickTeleportTickHotkeyType,
|
||||
(_, _) => { },
|
||||
(_, _) => { Thread.Sleep(100); },
|
||||
true
|
||||
);
|
||||
HotKeySettingModels.Add(quickTeleportTickHotKeySettingModel);
|
||||
|
||||
Reference in New Issue
Block a user