Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ee91489e1 |
No files matched your search
@@ -86,7 +86,7 @@ public partial class App : Application
|
||||
// My Services
|
||||
services.AddSingleton<TaskTriggerDispatcher>();
|
||||
services.AddSingleton<NotificationService>();
|
||||
services.AddHostedService(sp => sp.GetRequiredService<NotificationService>());
|
||||
services.AddHostedService<NotificationService>(sp => sp.GetRequiredService<NotificationService>());
|
||||
services.AddSingleton<NotifierManager>();
|
||||
|
||||
// Configuration
|
||||
|
||||
@@ -373,12 +373,6 @@
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_black_cancel.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_online_no.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\btn_online_yes.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\paimon_menu.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
public class Global
|
||||
{
|
||||
public static string Version { get; } = "0.27.0";
|
||||
public static string Version { get; } = "0.26.4";
|
||||
|
||||
public static string StartUpPath { get; } = AppContext.BaseDirectory;
|
||||
|
||||
|
||||
@@ -127,11 +127,4 @@ public partial class HotKeyConfig : ObservableObject
|
||||
|
||||
[ObservableProperty]
|
||||
private string _clickGenshinCancelButtonHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 一键战斗宏
|
||||
[ObservableProperty]
|
||||
private string _oneKeyFightHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _oneKeyFightHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
@@ -60,11 +59,11 @@ public partial class MacroConfig : ObservableObject
|
||||
/// 一键战斗宏快捷键模式
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _combatMacroHotkeyMode = OneKeyFightTask.HoldOnMode;
|
||||
private string _combatMacroHotkeyMode = "按住时重复";
|
||||
|
||||
/// <summary>
|
||||
/// 一键战斗宏优先级
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private int _combatMacroPriority = 1;
|
||||
private int _combatMacroPriority;
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Globalization;
|
||||
using Windows.Graphics.Imaging;
|
||||
using Windows.Media.Ocr;
|
||||
using Windows.Storage.Streams;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Recognition.OCR;
|
||||
|
||||
/// <summary>
|
||||
/// : IOcrService
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
public class MediaOcrService
|
||||
{
|
||||
private static readonly OcrEngine Engine =
|
||||
OcrEngine.TryCreateFromLanguage(new Language("zh-Hans-CN"));
|
||||
|
||||
/// <summary>
|
||||
/// 图片太小的时候这个方法会报错,无法判断图片类型
|
||||
/// BitmapDecoder (0x88982F50)
|
||||
/// https://github.com/microsoft/CsWinRT/issues/682
|
||||
/// </summary>
|
||||
/// <param name="bitmap"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OcrResult?> OcrAsync(Bitmap bitmap)
|
||||
{
|
||||
try
|
||||
{
|
||||
var stream = new InMemoryRandomAccessStream();
|
||||
bitmap.Save(stream.AsStream(), ImageFormat.Png);
|
||||
var decoder = BitmapDecoder.CreateAsync(stream).GetAwaiter().GetResult();
|
||||
var softwareBitmap = await decoder.GetSoftwareBitmapAsync();
|
||||
var ocrResult = await Engine.RecognizeAsync(softwareBitmap);
|
||||
softwareBitmap.Dispose();
|
||||
return ocrResult;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.WriteLine(e.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<OcrResult?> OcrAsyncByBytes(Bitmap bitmap)
|
||||
{
|
||||
try
|
||||
{
|
||||
var bytes = BitmapToByte(bitmap);
|
||||
var stream = new MemoryStream(bytes);
|
||||
var decoder = await BitmapDecoder.CreateAsync(stream.AsRandomAccessStream());
|
||||
var softwareBitmap = await decoder.GetSoftwareBitmapAsync();
|
||||
var ocrResult = await Engine.RecognizeAsync(softwareBitmap);
|
||||
softwareBitmap.Dispose();
|
||||
return ocrResult;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.WriteLine(e.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将BitMap转换成bytes数组
|
||||
/// </summary>
|
||||
/// <param name="bitmap">要转换的图像</param>
|
||||
/// <returns></returns>
|
||||
private byte[] BitmapToByte(Bitmap bitmap)
|
||||
{
|
||||
// 1.先将BitMap转成内存流
|
||||
var ms = new MemoryStream();
|
||||
bitmap.Save(ms, ImageFormat.Bmp);
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
// 2.再将内存流转成byte[]并返回
|
||||
var bytes = new byte[ms.Length];
|
||||
var _ = ms.Read(bytes, 0, bytes.Length);
|
||||
ms.Dispose();
|
||||
return bytes;
|
||||
}
|
||||
|
||||
//public async Task<OcrResult?> OcrAsyncByFile(Bitmap bitmap)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "temp.png");
|
||||
// bitmap.Save(path);
|
||||
// var storageFile = await StorageFile.GetFileFromPathAsync(path);
|
||||
// IRandomAccessStream randomAccessStream = await storageFile.OpenReadAsync();
|
||||
// var decoder = await BitmapDecoder.CreateAsync(randomAccessStream);
|
||||
// var softwareBitmap = await decoder.GetSoftwareBitmapAsync();
|
||||
// var ocrResult = await Engine.RecognizeAsync(softwareBitmap);
|
||||
// softwareBitmap.Dispose();
|
||||
// return ocrResult;
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// Console.WriteLine(e.Message);
|
||||
// return null;
|
||||
// }
|
||||
//}
|
||||
|
||||
public string Ocr(Bitmap bitmap)
|
||||
{
|
||||
var ocrResult = OcrAsyncByBytes(bitmap).GetAwaiter().GetResult();
|
||||
|
||||
if (ocrResult == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
Debug.WriteLine("MediaOcr结果: " + ocrResult.Text);
|
||||
return ocrResult.Text;
|
||||
}
|
||||
|
||||
public string Ocr(Mat mat)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,17 @@ namespace BetterGenshinImpact.Core.Recognition.OCR;
|
||||
public class OcrFactory
|
||||
{
|
||||
// public static IOcrService Media = Create(OcrEngineTypes.Media);
|
||||
public static IOcrService Paddle { get; } = Create(OcrEngineTypes.Paddle);
|
||||
public static IOcrService Paddle = Create(OcrEngineTypes.Paddle);
|
||||
|
||||
public static IOcrService Create(OcrEngineTypes type)
|
||||
{
|
||||
return type switch
|
||||
switch (type)
|
||||
{
|
||||
OcrEngineTypes.Paddle => new PaddleOcrService(),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null),
|
||||
};
|
||||
case OcrEngineTypes.Paddle:
|
||||
return new PaddleOcrService();
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(type), type, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
using BetterGenshinImpact.View.Drawable;
|
||||
using OpenCvSharp;
|
||||
using Sdcb.PaddleOCR;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
@@ -11,43 +10,44 @@ namespace BetterGenshinImpact.Core.Recognition.OCR;
|
||||
|
||||
public static class PaddleOcrResultExtension
|
||||
{
|
||||
public static bool RegionHasText(this PaddleOcrResult result, ReadOnlySpan<char> text)
|
||||
public static bool RegionHasText(this PaddleOcrResult result, string text)
|
||||
{
|
||||
foreach (ref readonly PaddleOcrResultRegion item in result.Regions.AsSpan())
|
||||
{
|
||||
if (item.Text.AsSpan().Contains(text, StringComparison.InvariantCulture))
|
||||
{
|
||||
foreach (var item in result.Regions)
|
||||
if (item.Text.Contains(text))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static PaddleOcrResultRegion FindRegionByText(this PaddleOcrResult result, ReadOnlySpan<char> text)
|
||||
public static PaddleOcrResultRegion FindRegionByText(this PaddleOcrResult result, string text)
|
||||
{
|
||||
foreach (ref readonly PaddleOcrResultRegion item in result.Regions.AsSpan())
|
||||
{
|
||||
if (item.Text.AsSpan().Contains(text, StringComparison.InvariantCulture))
|
||||
{
|
||||
foreach (var item in result.Regions)
|
||||
if (item.Text.Contains(text))
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return default;
|
||||
return new PaddleOcrResultRegion();
|
||||
}
|
||||
|
||||
//public static RotatedRect FindRotatedRectByText(this PaddleOcrResult result, string text)
|
||||
//{
|
||||
// foreach (var item in result.Regions)
|
||||
// {
|
||||
// if (item.Text.Contains(text))
|
||||
// {
|
||||
// return item.Rect;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return new RotatedRect();
|
||||
//}
|
||||
|
||||
public static Rect FindRectByText(this PaddleOcrResult result, string text)
|
||||
{
|
||||
foreach (ref PaddleOcrResultRegion item in result.Regions.AsSpan())
|
||||
{
|
||||
foreach (var item in result.Regions)
|
||||
if (item.Text.Contains(text))
|
||||
{
|
||||
return item.Rect.BoundingRect();
|
||||
}
|
||||
}
|
||||
|
||||
return default;
|
||||
return Rect.Empty;
|
||||
}
|
||||
|
||||
public static List<RectDrawable> ToRectDrawableList(this PaddleOcrResult result, Pen? pen = null)
|
||||
|
||||
@@ -3,7 +3,6 @@ using OpenCvSharp;
|
||||
using Sdcb.PaddleInference;
|
||||
using Sdcb.PaddleOCR;
|
||||
using Sdcb.PaddleOCR.Models;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
@@ -48,10 +47,11 @@ public class PaddleOcrService : IOcrService
|
||||
{
|
||||
lock (locker)
|
||||
{
|
||||
long startTime = Stopwatch.GetTimestamp();
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
var result = _paddleOcrAll.Run(mat);
|
||||
TimeSpan time = Stopwatch.GetElapsedTime(startTime);
|
||||
Debug.WriteLine($"PaddleOcr 耗时 {time.TotalMilliseconds}ms 结果: {result.Text}");
|
||||
stopwatch.Stop();
|
||||
Debug.WriteLine($"PaddleOcr 耗时 {stopwatch.ElapsedMilliseconds}ms 结果: {result.Text}");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,10 @@ using Microsoft.ML.OnnxRuntime;
|
||||
using Microsoft.ML.OnnxRuntime.Tensors;
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Recognition.ONNX.SVTR;
|
||||
@@ -40,56 +37,49 @@ public class PickTextInference : ITextInference
|
||||
|
||||
public string Inference(Mat mat)
|
||||
{
|
||||
long startTime = Stopwatch.GetTimestamp();
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
// 将输入数据调整为 (1, 1, 32, 384) 形状的张量
|
||||
var reshapedInputData = ToTensorUnsafe(mat, out var owner);
|
||||
var reshapedInputData = ToTensorUnsafe(mat);
|
||||
|
||||
IDisposableReadOnlyCollection<DisposableNamedOnnxValue> results;
|
||||
// 创建输入 NamedOnnxValue
|
||||
var inputs = new List<NamedOnnxValue> { NamedOnnxValue.CreateFromTensor("input", reshapedInputData) };
|
||||
|
||||
using (owner)
|
||||
// 运行模型推理
|
||||
using var results = _session.Run(inputs);
|
||||
|
||||
// 获取输出数据
|
||||
var resultsArray = results.ToArray();
|
||||
var boxes = resultsArray[0].AsTensor<float>();
|
||||
|
||||
var ans = "";
|
||||
var lastWord = "";
|
||||
for (var i = 0; i < boxes.Dimensions[0]; i++)
|
||||
{
|
||||
// 创建输入 NamedOnnxValue, 运行模型推理
|
||||
results = _session.Run([NamedOnnxValue.CreateFromTensor("input", reshapedInputData)]);
|
||||
}
|
||||
|
||||
using (results)
|
||||
{
|
||||
// 获取输出数据
|
||||
var boxes = results[0].AsTensor<float>();
|
||||
|
||||
var ans = new StringBuilder();
|
||||
var lastWord = default(string);
|
||||
for (var i = 0; i < boxes.Dimensions[0]; i++)
|
||||
var maxIndex = 0;
|
||||
var maxValue = -1.0;
|
||||
for (var j = 0; j < _wordDictionary.Count; j++)
|
||||
{
|
||||
var maxIndex = 0;
|
||||
var maxValue = -1.0;
|
||||
for (var j = 0; j < _wordDictionary.Count; j++)
|
||||
var value = boxes[i, 0, j];
|
||||
if (value > maxValue)
|
||||
{
|
||||
var value = boxes[[i, 0, j]];
|
||||
if (value > maxValue)
|
||||
{
|
||||
maxValue = value;
|
||||
maxIndex = j;
|
||||
}
|
||||
maxValue = value;
|
||||
maxIndex = j;
|
||||
}
|
||||
|
||||
var word = _wordDictionary[maxIndex];
|
||||
if (word != lastWord && word != "|")
|
||||
{
|
||||
ans.Append(word);
|
||||
}
|
||||
|
||||
lastWord = word;
|
||||
}
|
||||
|
||||
TimeSpan time = Stopwatch.GetElapsedTime(startTime);
|
||||
string result = ans.ToString();
|
||||
Debug.WriteLine($"Yap模型识别 耗时{time.TotalMilliseconds}ms 结果: {result}");
|
||||
return result;
|
||||
var word = _wordDictionary[maxIndex];
|
||||
if (word != lastWord && word != "|") ans += word;
|
||||
|
||||
lastWord = word;
|
||||
}
|
||||
|
||||
stopwatch.Stop();
|
||||
Debug.WriteLine($"Yap模型识别 耗时{stopwatch.ElapsedMilliseconds}ms 结果: {ans}");
|
||||
return ans;
|
||||
}
|
||||
|
||||
public static Tensor<float> ToTensorUnsafe(Mat src, out IMemoryOwner<float> tensorMemoryOwnser)
|
||||
public static Tensor<float> ToTensorUnsafe(Mat src)
|
||||
{
|
||||
var channels = src.Channels();
|
||||
var nRows = src.Rows;
|
||||
@@ -100,21 +90,18 @@ public class PickTextInference : ITextInference
|
||||
nRows = 1;
|
||||
}
|
||||
|
||||
//var inputData = new float[nCols];
|
||||
tensorMemoryOwnser = MemoryPool<float>.Shared.Rent(nCols);
|
||||
var memory = tensorMemoryOwnser.Memory[..nCols];
|
||||
var inputData = new float[nCols];
|
||||
unsafe
|
||||
{
|
||||
for (var i = 0; i < nRows; i++)
|
||||
{
|
||||
var b = (byte*)src.Ptr(i);
|
||||
for (var j = 0; j < nCols; j++)
|
||||
{
|
||||
memory.Span[j] = b[j] / 255f;
|
||||
}
|
||||
var p = src.Ptr(i);
|
||||
var b = (byte*)p.ToPointer();
|
||||
for (var j = 0; j < nCols; j++) inputData[j] = b[j] / 255f;
|
||||
}
|
||||
}
|
||||
|
||||
return new DenseTensor<float>(memory, [1, 1, 32, 384]);
|
||||
return new DenseTensor<float>(new Memory<float>(inputData), new[] { 1, 1, 32, 384 });
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,17 @@ namespace BetterGenshinImpact.Core.Recognition.ONNX.SVTR;
|
||||
|
||||
public class TextInferenceFactory
|
||||
{
|
||||
public static ITextInference Pick { get; } = Create(OcrEngineTypes.YapModel);
|
||||
public static ITextInference Pick = Create(OcrEngineTypes.YapModel);
|
||||
|
||||
public static ITextInference Create(OcrEngineTypes type)
|
||||
{
|
||||
return type switch
|
||||
switch (type)
|
||||
{
|
||||
OcrEngineTypes.YapModel => new PickTextInference(),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null),
|
||||
};
|
||||
case OcrEngineTypes.YapModel:
|
||||
return new PickTextInference();
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(type), type, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,12 @@ namespace BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
|
||||
public static class CommonExtension
|
||||
{
|
||||
public static unsafe Point AsCvPoint(this System.Drawing.Point point)
|
||||
public static unsafe Point ToCvPoint(this System.Drawing.Point point)
|
||||
{
|
||||
return *(Point*)&point;
|
||||
}
|
||||
|
||||
public static unsafe System.Drawing.Point AsDrawingPoint(this Point point)
|
||||
public static unsafe System.Drawing.Point ToDrawingPoint(this Point point)
|
||||
{
|
||||
return *(System.Drawing.Point*)&point;
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public static class CommonExtension
|
||||
return new System.Windows.Point(point.X, point.Y);
|
||||
}
|
||||
|
||||
public static unsafe Rect AsCvRect(this Rectangle rectangle)
|
||||
public static unsafe Rect ToCvRect(this Rectangle rectangle)
|
||||
{
|
||||
return *(Rect*)&rectangle;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public static class CommonExtension
|
||||
return new System.Windows.Rect(rect.X + offsetX, rect.Y + offsetY, rect.Width, rect.Height);
|
||||
}
|
||||
|
||||
public static unsafe Rectangle AsDrawingRectangle(this Rect rect)
|
||||
public static unsafe Rectangle ToDrawingRectangle(this Rect rect)
|
||||
{
|
||||
return *(Rectangle*)▭
|
||||
}
|
||||
|
||||
@@ -40,6 +40,6 @@ public class CommonRecognition
|
||||
Debug.WriteLine(e);
|
||||
}
|
||||
|
||||
return [];
|
||||
return new List<Rect>();
|
||||
}
|
||||
}
|
||||
@@ -27,11 +27,18 @@ public class MatchTemplateHelper
|
||||
try
|
||||
{
|
||||
using var result = new Mat();
|
||||
Cv2.MatchTemplate(srcMat, dstMat, result, matchMode, maskMat!);
|
||||
if (maskMat == null)
|
||||
{
|
||||
Cv2.MatchTemplate(srcMat, dstMat, result, matchMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
Cv2.MatchTemplate(srcMat, dstMat, result, matchMode, maskMat);
|
||||
}
|
||||
|
||||
if (matchMode is TemplateMatchModes.SqDiff or TemplateMatchModes.CCoeff or TemplateMatchModes.CCorr)
|
||||
{
|
||||
Cv2.Normalize(result, result, 0, 1, NormTypes.MinMax);
|
||||
Cv2.Normalize(result, result, 0, 1, NormTypes.MinMax, -1, null);
|
||||
}
|
||||
|
||||
Cv2.MinMaxLoc(result, out var minValue, out var maxValue, out var minLoc, out var maxLoc);
|
||||
@@ -51,13 +58,12 @@ public class MatchTemplateHelper
|
||||
}
|
||||
}
|
||||
|
||||
return default;
|
||||
return new Point();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex.Message);
|
||||
_logger.LogDebug(ex, ex.Message);
|
||||
return default;
|
||||
_logger.LogError(ex.ToString());
|
||||
return new Point();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,14 +77,16 @@ public class MatchTemplateHelper
|
||||
/// <param name="threshold"></param>
|
||||
/// <param name="maxCount"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete]
|
||||
public static List<Point> MatchTemplateMulti(Mat srcMat, Mat dstMat, Mat? maskMat = null, double threshold = 0.8, int maxCount = 8)
|
||||
{
|
||||
var points = new List<Point>();
|
||||
try
|
||||
{
|
||||
using var result = new Mat();
|
||||
Cv2.MatchTemplate(srcMat, dstMat, result, TemplateMatchModes.CCoeffNormed, maskMat!);
|
||||
if (maskMat == null)
|
||||
Cv2.MatchTemplate(srcMat, dstMat, result, TemplateMatchModes.CCoeffNormed);
|
||||
else
|
||||
Cv2.MatchTemplate(srcMat, dstMat, result, TemplateMatchModes.CCoeffNormed, maskMat);
|
||||
|
||||
var mask = new Mat(result.Height, result.Width, MatType.CV_8UC1, Scalar.White);
|
||||
var maskSub = new Mat(result.Height, result.Width, MatType.CV_8UC1, Scalar.Black);
|
||||
@@ -98,8 +106,7 @@ public class MatchTemplateHelper
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex.Message);
|
||||
_logger.LogDebug(ex, ex.Message);
|
||||
_logger.LogError("{Ex}", ex);
|
||||
return points;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Script;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
|
||||
public class AvatarMacro
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string ScriptContent1 { get; set; } = string.Empty;
|
||||
public string ScriptContent2 { get; set; } = string.Empty;
|
||||
public string ScriptContent3 { get; set; } = string.Empty;
|
||||
public string ScriptContent4 { get; set; } = string.Empty;
|
||||
public string ScriptContent5 { get; set; } = string.Empty;
|
||||
|
||||
public string GetScriptContent(int index)
|
||||
{
|
||||
return index switch
|
||||
{
|
||||
1 => ScriptContent1,
|
||||
2 => ScriptContent2,
|
||||
3 => ScriptContent3,
|
||||
4 => ScriptContent4,
|
||||
5 => ScriptContent5,
|
||||
_ => string.Empty
|
||||
};
|
||||
}
|
||||
|
||||
public string GetScriptContent()
|
||||
{
|
||||
return GetScriptContent(TaskContext.Instance().Config.MacroConfig.CombatMacroPriority);
|
||||
}
|
||||
|
||||
public List<CombatCommand>? LoadCommands()
|
||||
{
|
||||
var content = GetScriptContent();
|
||||
if (string.IsNullOrWhiteSpace(content))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return CombatScriptParser.ParseLineCommands(content, Name);
|
||||
}
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public class CombatScenes : IDisposable
|
||||
if (result.Confidence < 0.8)
|
||||
{
|
||||
Cv2.ImWrite(@"log\avatar_side_classify_error.png", src.ToMat());
|
||||
throw new Exception($"无法识别第{index}位角色,置信度{result.Confidence},结果:{result.Class.Name}");
|
||||
throw new Exception($"无法识别第{index}位角色,置信度{result.Confidence}");
|
||||
}
|
||||
|
||||
return result.Class.Name;
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
using BetterGenshinImpact.Model;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Script;
|
||||
using BetterGenshinImpact.Service;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight;
|
||||
|
||||
@@ -19,180 +9,8 @@ namespace BetterGenshinImpact.GameTask.AutoFight;
|
||||
/// </summary>
|
||||
public class OneKeyFightTask : Singleton<OneKeyFightTask>
|
||||
{
|
||||
public static readonly string HoldOnMode = "按住时重复";
|
||||
public static readonly string TickMode = "触发";
|
||||
|
||||
private Dictionary<string, List<CombatCommand>>? _avatarMacros;
|
||||
private CancellationTokenSource? _cts = null;
|
||||
private Task? _fightTask;
|
||||
|
||||
private bool _isKeyDown = false;
|
||||
private int activeMacroPriority = -1;
|
||||
|
||||
public void KeyDown()
|
||||
public void Run()
|
||||
{
|
||||
if (_isKeyDown || !IsEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
_isKeyDown = true;
|
||||
if (activeMacroPriority != TaskContext.Instance().Config.MacroConfig.CombatMacroPriority)
|
||||
{
|
||||
activeMacroPriority = TaskContext.Instance().Config.MacroConfig.CombatMacroPriority;
|
||||
_avatarMacros = LoadAvatarMacros();
|
||||
Logger.LogInformation("加载一键宏配置完成");
|
||||
}
|
||||
|
||||
if (IsHoldOnMode())
|
||||
{
|
||||
if (_cts == null || _cts.Token.IsCancellationRequested)
|
||||
{
|
||||
_cts = new CancellationTokenSource();
|
||||
_fightTask = FightTask(_cts);
|
||||
if (!_fightTask.IsCompleted)
|
||||
{
|
||||
_fightTask.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (IsTickMode())
|
||||
{
|
||||
if (_cts == null || _cts.Token.IsCancellationRequested)
|
||||
{
|
||||
_cts = new CancellationTokenSource();
|
||||
_fightTask = FightTask(_cts);
|
||||
if (!_fightTask.IsCompleted)
|
||||
{
|
||||
_fightTask.Start();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_cts.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void KeyUp()
|
||||
{
|
||||
_isKeyDown = false;
|
||||
if (!IsEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsHoldOnMode())
|
||||
{
|
||||
_cts?.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
// public void Run()
|
||||
// {
|
||||
// if (!IsEnabled())
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// _avatarMacros ??= LoadAvatarMacros();
|
||||
//
|
||||
// if (IsHoldOnMode())
|
||||
// {
|
||||
// if (_fightTask == null || _fightTask.IsCompleted)
|
||||
// {
|
||||
// _fightTask = FightTask(_cts);
|
||||
// _fightTask.Start();
|
||||
// }
|
||||
// Thread.Sleep(100);
|
||||
// }
|
||||
// else if (IsTickMode())
|
||||
// {
|
||||
// if (_cts.Token.IsCancellationRequested)
|
||||
// {
|
||||
// _cts = new CancellationTokenSource();
|
||||
// Task.Run(() => FightTask(_cts));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _cts.Cancel();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 循环执行战斗宏
|
||||
/// </summary>
|
||||
private Task FightTask(CancellationTokenSource cts)
|
||||
{
|
||||
var content = GetContentFromDispatcher();
|
||||
var combatScenes = new CombatScenes().InitializeTeam(content);
|
||||
if (!combatScenes.CheckTeamInitialized())
|
||||
{
|
||||
Logger.LogError("队伍角色识别失败");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
// 找到出战角色
|
||||
var activeAvatar = combatScenes.Avatars.First(avatar => avatar.IsActive(content));
|
||||
|
||||
if (_avatarMacros != null && _avatarMacros.TryGetValue(activeAvatar.Name, out var combatCommands))
|
||||
{
|
||||
return new Task(() =>
|
||||
{
|
||||
Logger.LogInformation("→ {Name}执行宏", activeAvatar.Name);
|
||||
while (!cts.Token.IsCancellationRequested && IsEnabled())
|
||||
{
|
||||
if (IsHoldOnMode() && !_isKeyDown)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// 通用化战斗策略
|
||||
foreach (var command in combatCommands)
|
||||
{
|
||||
command.Execute(activeAvatar);
|
||||
}
|
||||
}
|
||||
Logger.LogInformation("→ {Name}停止宏", activeAvatar.Name);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning("→ {Name}配置[{Priority}]为空,请先配置一键宏", activeAvatar.Name, activeMacroPriority);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<string, List<CombatCommand>> LoadAvatarMacros()
|
||||
{
|
||||
var json = File.ReadAllText(Global.Absolute("User/avatar_macro.json"));
|
||||
var avatarMacros = JsonSerializer.Deserialize<List<AvatarMacro>>(json, ConfigService.JsonOptions);
|
||||
if (avatarMacros == null)
|
||||
{
|
||||
return new Dictionary<string, List<CombatCommand>>();
|
||||
}
|
||||
var result = new Dictionary<string, List<CombatCommand>>();
|
||||
foreach (var avatarMacro in avatarMacros)
|
||||
{
|
||||
var commands = avatarMacro.LoadCommands();
|
||||
if (commands != null)
|
||||
{
|
||||
result.Add(avatarMacro.Name, commands);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool IsEnabled()
|
||||
{
|
||||
return TaskContext.Instance().Config.MacroConfig.CombatMacroEnabled;
|
||||
}
|
||||
|
||||
public static bool IsHoldOnMode()
|
||||
{
|
||||
return TaskContext.Instance().Config.MacroConfig.CombatMacroHotkeyMode == HoldOnMode;
|
||||
}
|
||||
|
||||
public static bool IsTickMode()
|
||||
{
|
||||
return TaskContext.Instance().Config.MacroConfig.CombatMacroHotkeyMode == TickMode;
|
||||
var combatScenes = new CombatScenes().InitializeTeam(GetContentFromDispatcher());
|
||||
}
|
||||
}
|
||||
@@ -83,11 +83,6 @@ public class CombatCommand
|
||||
avatar.Switch();
|
||||
}
|
||||
|
||||
Execute(avatar);
|
||||
}
|
||||
|
||||
public void Execute(Avatar avatar)
|
||||
{
|
||||
if (Method == Method.Skill)
|
||||
{
|
||||
var hold = Args != null && Args.Contains("hold");
|
||||
@@ -235,4 +230,4 @@ public class CombatCommand
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,8 +78,61 @@ public class CombatScriptParser
|
||||
HashSet<string> combatAvatarNames = new();
|
||||
foreach (var line in lines)
|
||||
{
|
||||
var oneLineCombatCommands = ParseLine(line, combatAvatarNames);
|
||||
combatCommands.AddRange(oneLineCombatCommands);
|
||||
// 以空格分隔角色和指令 截取第一个空格前的内容为角色名称,后面的为指令
|
||||
var firstSpaceIndex = line.IndexOf(' ');
|
||||
if (firstSpaceIndex < 0)
|
||||
{
|
||||
Logger.LogError("战斗脚本格式错误,必须以空格分隔角色和指令");
|
||||
throw new Exception("战斗脚本格式错误,必须以空格分隔角色和指令");
|
||||
}
|
||||
|
||||
var character = line[..firstSpaceIndex];
|
||||
character = DefaultAutoFightConfig.AvatarAliasToStandardName(character);
|
||||
var commands = line[(firstSpaceIndex + 1)..];
|
||||
var commandArray = commands.Split(",", StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
for (var i = 0; i < commandArray.Length; i++)
|
||||
{
|
||||
var command = commandArray[i];
|
||||
if (string.IsNullOrEmpty(command))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (command.Contains("(") && !command.Contains(")"))
|
||||
{
|
||||
var j = i + 1;
|
||||
// 括号被逗号分隔,需要合并
|
||||
while (j < commandArray.Length)
|
||||
{
|
||||
command += "," + commandArray[j];
|
||||
if (command.Count("(".Contains) > 1)
|
||||
{
|
||||
Logger.LogError("战斗脚本格式错误,指令 {Cmd} 括号无法配对", command);
|
||||
throw new Exception("战斗脚本格式错误,指令括号无法配对");
|
||||
}
|
||||
|
||||
if (command.Contains(")"))
|
||||
{
|
||||
i = j;
|
||||
break;
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
if (!(command.Contains("(") && command.Contains(")")))
|
||||
{
|
||||
Logger.LogError("战斗脚本格式错误,指令 {Cmd} 括号不完整", command);
|
||||
throw new Exception("战斗脚本格式错误,指令括号不完整");
|
||||
}
|
||||
}
|
||||
|
||||
var combatCommand = new CombatCommand(character, command);
|
||||
combatCommands.Add(combatCommand);
|
||||
}
|
||||
|
||||
combatAvatarNames.Add(character);
|
||||
}
|
||||
|
||||
var names = string.Join(",", combatAvatarNames);
|
||||
@@ -87,72 +140,4 @@ public class CombatScriptParser
|
||||
|
||||
return new CombatScript(combatAvatarNames, combatCommands);
|
||||
}
|
||||
|
||||
public static List<CombatCommand> ParseLine(string line, HashSet<string> combatAvatarNames)
|
||||
{
|
||||
var oneLineCombatCommands = new List<CombatCommand>();
|
||||
// 以空格分隔角色和指令 截取第一个空格前的内容为角色名称,后面的为指令
|
||||
var firstSpaceIndex = line.IndexOf(' ');
|
||||
if (firstSpaceIndex < 0)
|
||||
{
|
||||
Logger.LogError("战斗脚本格式错误,必须以空格分隔角色和指令");
|
||||
throw new Exception("战斗脚本格式错误,必须以空格分隔角色和指令");
|
||||
}
|
||||
|
||||
var character = line[..firstSpaceIndex];
|
||||
character = DefaultAutoFightConfig.AvatarAliasToStandardName(character);
|
||||
var commands = line[(firstSpaceIndex + 1)..];
|
||||
oneLineCombatCommands.AddRange(ParseLineCommands(commands, character));
|
||||
combatAvatarNames.Add(character);
|
||||
return oneLineCombatCommands;
|
||||
}
|
||||
|
||||
public static List<CombatCommand> ParseLineCommands(string lineWithoutAvatar, string avatarName)
|
||||
{
|
||||
var oneLineCombatCommands = new List<CombatCommand>();
|
||||
var commandArray = lineWithoutAvatar.Split(",", StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
for (var i = 0; i < commandArray.Length; i++)
|
||||
{
|
||||
var command = commandArray[i];
|
||||
if (string.IsNullOrEmpty(command))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (command.Contains("(") && !command.Contains(")"))
|
||||
{
|
||||
var j = i + 1;
|
||||
// 括号被逗号分隔,需要合并
|
||||
while (j < commandArray.Length)
|
||||
{
|
||||
command += "," + commandArray[j];
|
||||
if (command.Count("(".Contains) > 1)
|
||||
{
|
||||
Logger.LogError("战斗脚本格式错误,指令 {Cmd} 括号无法配对", command);
|
||||
throw new Exception("战斗脚本格式错误,指令括号无法配对");
|
||||
}
|
||||
|
||||
if (command.Contains(")"))
|
||||
{
|
||||
i = j;
|
||||
break;
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
if (!(command.Contains("(") && command.Contains(")")))
|
||||
{
|
||||
Logger.LogError("战斗脚本格式错误,指令 {Cmd} 括号不完整", command);
|
||||
throw new Exception("战斗脚本格式错误,指令括号不完整");
|
||||
}
|
||||
}
|
||||
|
||||
var combatCommand = new CombatCommand(avatarName, command);
|
||||
oneLineCombatCommands.Add(combatCommand);
|
||||
}
|
||||
|
||||
return oneLineCombatCommands;
|
||||
}
|
||||
}
|
||||
@@ -49,25 +49,13 @@ namespace BetterGenshinImpact.GameTask.AutoSkip
|
||||
[ObservableProperty] private string _autoReExploreCharacter = "";
|
||||
|
||||
/// <summary>
|
||||
/// 优先选择第一个选项
|
||||
/// 优先选择最后一个选项
|
||||
/// 不选择选项
|
||||
/// 优先点击第一个选项
|
||||
/// </summary>
|
||||
[ObservableProperty] private string _clickChatOption = "优先选择最后一个选项";
|
||||
[ObservableProperty] private bool _clickFirstOptionEnabled = false;
|
||||
|
||||
/// <summary>
|
||||
/// 自动邀约启用
|
||||
/// </summary>
|
||||
[ObservableProperty] private bool _autoHangoutEventEnabled = false;
|
||||
|
||||
public bool IsClickFirstChatOption()
|
||||
{
|
||||
return ClickChatOption == "优先选择第一个选项";
|
||||
}
|
||||
|
||||
public bool IsClickNoneChatOption()
|
||||
{
|
||||
return ClickChatOption == "不选择选项";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -370,11 +370,6 @@ public class AutoSkipTrigger : ITaskTrigger
|
||||
/// </summary>
|
||||
private bool ChatOptionChoose(CaptureContent content)
|
||||
{
|
||||
if (_config.IsClickNoneChatOption())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var captureArea = TaskContext.Instance().SystemInfo.CaptureAreaRect;
|
||||
var assetScale = TaskContext.Instance().SystemInfo.AssetScale;
|
||||
|
||||
@@ -484,7 +479,7 @@ public class AutoSkipTrigger : ITaskTrigger
|
||||
|
||||
// 最后,选择默认选项
|
||||
var clickRegion = rs[^1];
|
||||
if (_config.IsClickFirstChatOption())
|
||||
if (_config.ClickFirstOptionEnabled)
|
||||
{
|
||||
clickRegion = rs[0];
|
||||
}
|
||||
@@ -495,7 +490,7 @@ public class AutoSkipTrigger : ITaskTrigger
|
||||
else
|
||||
{
|
||||
var clickRect = lowest;
|
||||
if (_config.IsClickFirstChatOption())
|
||||
if (_config.ClickFirstOptionEnabled)
|
||||
{
|
||||
clickRect = chatOptionResultList[^1];
|
||||
}
|
||||
@@ -504,7 +499,7 @@ public class AutoSkipTrigger : ITaskTrigger
|
||||
TaskControl.Sleep(_config.AfterChooseOptionSleepDelay);
|
||||
var clickOffset = new ClickOffset(captureArea.X + _autoSkipAssets.OptionRoi.X, captureArea.Y + _autoSkipAssets.OptionRoi.Y, assetScale);
|
||||
clickOffset.ClickWithoutScale(clickRect.X + clickRect.Width / 2, clickRect.Y + clickRect.Height / 2);
|
||||
var msg = _config.IsClickFirstChatOption() ? "第一个" : "最后一个";
|
||||
var msg = _config.ClickFirstOptionEnabled ? "第一个" : "最后一个";
|
||||
AutoSkipLog($"点击{msg}气泡选项");
|
||||
}
|
||||
|
||||
|
||||
@@ -59,11 +59,6 @@ public static partial class Bv
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击黑色取消按钮
|
||||
/// </summary>
|
||||
/// <param name="captureRa"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ClickBlackCancelButton(RectArea captureRa)
|
||||
{
|
||||
var ra = captureRa.Find(ElementAssets.Instance.BtnBlackCancel);
|
||||
@@ -75,38 +70,6 @@ public static partial class Bv
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击联机确认按钮
|
||||
/// </summary>
|
||||
/// <param name="captureRa"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ClickOnlineYesButton(RectArea captureRa)
|
||||
{
|
||||
var ra = captureRa.Find(ElementAssets.Instance.BtnOnlineYes);
|
||||
if (ra.IsExist())
|
||||
{
|
||||
ra.ClickCenter();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击联机取消按钮
|
||||
/// </summary>
|
||||
/// <param name="captureRa"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ClickOnlineNoButton(RectArea captureRa)
|
||||
{
|
||||
var ra = captureRa.Find(ElementAssets.Instance.BtnOnlineNo);
|
||||
if (ra.IsExist())
|
||||
{
|
||||
ra.ClickCenter();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击确认按钮(优先点击白色背景的确认按钮)
|
||||
/// </summary>
|
||||
@@ -114,7 +77,7 @@ public static partial class Bv
|
||||
/// <returns></returns>
|
||||
public static bool ClickConfirmButton(RectArea captureRa)
|
||||
{
|
||||
return ClickBlackConfirmButton(captureRa) || ClickWhiteConfirmButton(captureRa) || ClickOnlineYesButton(captureRa);
|
||||
return ClickBlackConfirmButton(captureRa) || ClickWhiteConfirmButton(captureRa);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -124,6 +87,6 @@ public static partial class Bv
|
||||
/// <returns></returns>
|
||||
public static bool ClickCancelButton(RectArea captureRa)
|
||||
{
|
||||
return ClickBlackCancelButton(captureRa) || ClickWhiteCancelButton(captureRa) || ClickOnlineNoButton(captureRa);
|
||||
return ClickBlackCancelButton(captureRa) || ClickWhiteCancelButton(captureRa);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.0 KiB |
@@ -10,8 +10,6 @@ public class ElementAssets : BaseAssets<ElementAssets>
|
||||
public RecognitionObject BtnWhiteCancel;
|
||||
public RecognitionObject BtnBlackConfirm;
|
||||
public RecognitionObject BtnBlackCancel;
|
||||
public RecognitionObject BtnOnlineYes;
|
||||
public RecognitionObject BtnOnlineNo;
|
||||
|
||||
public RecognitionObject PaimonMenuRo;
|
||||
public RecognitionObject BlueTrackPoint;
|
||||
@@ -47,20 +45,6 @@ public class ElementAssets : BaseAssets<ElementAssets>
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "btn_black_cancel.png"),
|
||||
Use3Channels = true
|
||||
}.InitTemplate();
|
||||
BtnOnlineYes = new RecognitionObject
|
||||
{
|
||||
Name = "BtnOnlineYes",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "btn_online_yes.png"),
|
||||
Use3Channels = true
|
||||
}.InitTemplate();
|
||||
BtnOnlineNo = new RecognitionObject
|
||||
{
|
||||
Name = "BtnOnlineNo",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage(@"Common\Element", "btn_online_no.png"),
|
||||
Use3Channels = true
|
||||
}.InitTemplate();
|
||||
|
||||
// 派蒙菜单
|
||||
// 此图38x40 小地图210x210 小地图左上角位置 24,-15
|
||||
|
||||
@@ -64,7 +64,7 @@ public class TaskControl
|
||||
}
|
||||
}, TimeSpan.FromSeconds(1), 100);
|
||||
Thread.Sleep(millisecondsTimeout);
|
||||
if (cts is { IsCancellationRequested: true })
|
||||
if (cts.IsCancellationRequested)
|
||||
{
|
||||
throw new NormalEndException("取消自动任务");
|
||||
}
|
||||
@@ -138,19 +138,11 @@ public class TaskControl
|
||||
return CaptureToContent().CaptureRectArea;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 此方法 TaskDispatcher至少处于 DispatcherCaptureModeEnum.CacheCaptureWithTrigger 状态才能使用
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static CaptureContent GetContentFromDispatcher()
|
||||
{
|
||||
return TaskTriggerDispatcher.Instance().GetLastCaptureContent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 此方法 TaskDispatcher至少处于 DispatcherCaptureModeEnum.CacheCaptureWithTrigger 状态才能使用
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static RectArea GetRectAreaFromDispatcher()
|
||||
{
|
||||
return GetContentFromDispatcher().CaptureRectArea;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace BetterGenshinImpact.GameTask
|
||||
public class TaskContext
|
||||
{
|
||||
private static TaskContext? _uniqueInstance;
|
||||
private static object? InstanceLocker;
|
||||
private static readonly object InstanceLocker = new();
|
||||
|
||||
private TaskContext()
|
||||
{
|
||||
@@ -22,7 +22,15 @@ namespace BetterGenshinImpact.GameTask
|
||||
|
||||
public static TaskContext Instance()
|
||||
{
|
||||
return LazyInitializer.EnsureInitialized(ref _uniqueInstance, ref InstanceLocker, () => new TaskContext());
|
||||
if (_uniqueInstance == null)
|
||||
{
|
||||
lock (InstanceLocker)
|
||||
{
|
||||
_uniqueInstance ??= new TaskContext();
|
||||
}
|
||||
}
|
||||
|
||||
return _uniqueInstance;
|
||||
}
|
||||
|
||||
public void Init(IntPtr hWnd)
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace BetterGenshinImpact.GameTask
|
||||
);
|
||||
|
||||
// 捕获模式初始化配置
|
||||
if (TaskContext.Instance().Config.CommonConfig.ScreenshotEnabled || TaskContext.Instance().Config.MacroConfig.CombatMacroEnabled)
|
||||
if (TaskContext.Instance().Config.CommonConfig.ScreenshotEnabled)
|
||||
{
|
||||
_dispatcherCacheCaptureMode = DispatcherCaptureModeEnum.CacheCaptureWithTrigger;
|
||||
}
|
||||
@@ -381,7 +381,7 @@ namespace BetterGenshinImpact.GameTask
|
||||
if ((_gameRect.Width != currentRect.Width || _gameRect.Height != currentRect.Height)
|
||||
&& !SizeIsZero(_gameRect) && !SizeIsZero(currentRect))
|
||||
{
|
||||
_logger.LogError("游戏窗口大小发生变化 {W}x{H}->{CW}x{CH}, 请重启整个软件!", _gameRect.Width, _gameRect.Height, currentRect.Width, currentRect.Height);
|
||||
_logger.LogError("游戏窗口大小发生变化 {W}x{H}->{CW}x{CH}, 请重新启动捕获程序!", _gameRect.Width, _gameRect.Height, currentRect.Width, currentRect.Height);
|
||||
}
|
||||
|
||||
_gameRect = new RECT(currentRect);
|
||||
|
||||
@@ -15,6 +15,7 @@ public partial class HotKeySettingModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty] private HotKey _hotKey;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 键鼠监听、全局热键
|
||||
/// </summary>
|
||||
@@ -26,9 +27,7 @@ public partial class HotKeySettingModel : ObservableObject
|
||||
|
||||
public string ConfigPropertyName { get; set; }
|
||||
|
||||
public Action<object?, KeyPressedEventArgs>? OnKeyPressAction { get; set; }
|
||||
public Action<object?, KeyPressedEventArgs>? OnKeyDownAction { get; set; }
|
||||
public Action<object?, KeyPressedEventArgs>? OnKeyUpAction { get; set; }
|
||||
public Action<object?, KeyPressedEventArgs> OnKeyAction { get; set; }
|
||||
|
||||
public bool IsHold { get; set; }
|
||||
|
||||
@@ -49,14 +48,15 @@ public partial class HotKeySettingModel : ObservableObject
|
||||
/// </summary>
|
||||
public MouseHook? MouseMonitorHook { get; set; }
|
||||
|
||||
public HotKeySettingModel(string functionName, string configPropertyName, string hotkey, string hotKeyTypeCode, Action<object?, KeyPressedEventArgs>? onKeyPressAction, bool isHold = false)
|
||||
|
||||
public HotKeySettingModel(string functionName, string configPropertyName, string hotkey, string hotKeyTypeCode, Action<object?, KeyPressedEventArgs> onKeyAction, bool isHold = false)
|
||||
{
|
||||
FunctionName = functionName;
|
||||
ConfigPropertyName = configPropertyName;
|
||||
HotKey = HotKey.FromString(hotkey);
|
||||
HotKeyType = (HotKeyTypeEnum)Enum.Parse(typeof(HotKeyTypeEnum), hotKeyTypeCode);
|
||||
HotKeyTypeName = HotKeyType.ToChineseName();
|
||||
OnKeyPressAction = onKeyPressAction;
|
||||
OnKeyAction = onKeyAction;
|
||||
IsHold = isHold;
|
||||
SwitchHotkeyTypeEnabled = !isHold;
|
||||
}
|
||||
@@ -75,11 +75,8 @@ public partial class HotKeySettingModel : ObservableObject
|
||||
Hotkey hotkey = new(HotKey.ToString());
|
||||
GlobalRegisterHook?.Dispose();
|
||||
GlobalRegisterHook = new HotkeyHook();
|
||||
if (OnKeyPressAction != null)
|
||||
{
|
||||
GlobalRegisterHook.KeyPressed -= OnKeyPressed;
|
||||
GlobalRegisterHook.KeyPressed += OnKeyPressed;
|
||||
}
|
||||
GlobalRegisterHook.KeyPressed -= OnKeyPressed;
|
||||
GlobalRegisterHook.KeyPressed += OnKeyPressed;
|
||||
GlobalRegisterHook.RegisterHotKey(hotkey.ModifierKey, hotkey.Key);
|
||||
}
|
||||
else
|
||||
@@ -92,22 +89,8 @@ public partial class HotKeySettingModel : ObservableObject
|
||||
{
|
||||
IsHold = IsHold
|
||||
};
|
||||
|
||||
if (OnKeyPressAction != null)
|
||||
{
|
||||
MouseMonitorHook.MousePressed -= OnKeyPressed;
|
||||
MouseMonitorHook.MousePressed += OnKeyPressed;
|
||||
}
|
||||
if (OnKeyDownAction != null)
|
||||
{
|
||||
MouseMonitorHook.MouseDownEvent -= OnKeyDown;
|
||||
MouseMonitorHook.MouseDownEvent += OnKeyDown;
|
||||
}
|
||||
if (OnKeyUpAction != null)
|
||||
{
|
||||
MouseMonitorHook.MouseUpEvent -= OnKeyUp;
|
||||
MouseMonitorHook.MouseUpEvent += OnKeyUp;
|
||||
}
|
||||
MouseMonitorHook.MousePressed -= OnKeyPressed;
|
||||
MouseMonitorHook.MousePressed += OnKeyPressed;
|
||||
MouseMonitorHook.RegisterHotKey((MouseButtons)Enum.Parse(typeof(MouseButtons), HotKey.MouseButton.ToString()));
|
||||
}
|
||||
else
|
||||
@@ -122,22 +105,8 @@ public partial class HotKeySettingModel : ObservableObject
|
||||
{
|
||||
IsHold = IsHold
|
||||
};
|
||||
if (OnKeyPressAction != null)
|
||||
{
|
||||
KeyboardMonitorHook.KeyPressedEvent -= OnKeyPressed;
|
||||
KeyboardMonitorHook.KeyPressedEvent += OnKeyPressed;
|
||||
}
|
||||
if (OnKeyDownAction != null)
|
||||
{
|
||||
KeyboardMonitorHook.KeyDownEvent -= OnKeyDown;
|
||||
KeyboardMonitorHook.KeyDownEvent += OnKeyDown;
|
||||
}
|
||||
if (OnKeyUpAction != null)
|
||||
{
|
||||
KeyboardMonitorHook.KeyUpEvent -= OnKeyUp;
|
||||
KeyboardMonitorHook.KeyUpEvent += OnKeyUp;
|
||||
}
|
||||
|
||||
KeyboardMonitorHook.KeyPressed -= OnKeyPressed;
|
||||
KeyboardMonitorHook.KeyPressed += OnKeyPressed;
|
||||
KeyboardMonitorHook.RegisterHotKey((Keys)Enum.Parse(typeof(Keys), HotKey.Key.ToString()));
|
||||
}
|
||||
}
|
||||
@@ -151,17 +120,7 @@ public partial class HotKeySettingModel : ObservableObject
|
||||
|
||||
private void OnKeyPressed(object? sender, KeyPressedEventArgs e)
|
||||
{
|
||||
OnKeyPressAction?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
private void OnKeyDown(object? sender, KeyPressedEventArgs e)
|
||||
{
|
||||
OnKeyDownAction?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
private void OnKeyUp(object? sender, KeyPressedEventArgs e)
|
||||
{
|
||||
OnKeyUpAction?.Invoke(sender, e);
|
||||
OnKeyAction.Invoke(sender, e);
|
||||
}
|
||||
|
||||
public void UnRegisterHotKey()
|
||||
@@ -177,4 +136,4 @@ public partial class HotKeySettingModel : ObservableObject
|
||||
HotKeyType = HotKeyType == HotKeyTypeEnum.GlobalRegister ? HotKeyTypeEnum.KeyboardMonitor : HotKeyTypeEnum.GlobalRegister;
|
||||
HotKeyTypeName = HotKeyType.ToChineseName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,11 +12,7 @@ public class KeyboardHook
|
||||
{
|
||||
public static Dictionary<Keys, KeyboardHook> AllKeyboardHooks = new();
|
||||
|
||||
public event EventHandler<KeyPressedEventArgs>? KeyPressedEvent = null;
|
||||
|
||||
public event EventHandler<KeyPressedEventArgs>? KeyDownEvent = null;
|
||||
|
||||
public event EventHandler<KeyPressedEventArgs>? KeyUpEvent = null;
|
||||
public event EventHandler<KeyPressedEventArgs>? KeyPressed = null;
|
||||
|
||||
public bool IsHold { get; set; }
|
||||
|
||||
@@ -24,11 +20,6 @@ public class KeyboardHook
|
||||
|
||||
public bool IsPressed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 注意长按的时候会一直触发KeyDown
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
public void KeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
if (!SystemControl.IsGenshinImpactActive())
|
||||
@@ -39,17 +30,13 @@ public class KeyboardHook
|
||||
if (e.KeyCode == BindKey)
|
||||
{
|
||||
IsPressed = true;
|
||||
KeyDownEvent?.Invoke(this, new KeyPressedEventArgs(User32.HotKeyModifiers.MOD_NONE, e.KeyCode));
|
||||
if (IsHold)
|
||||
{
|
||||
if (KeyPressedEvent != null)
|
||||
{
|
||||
Task.Run(() => RunAction(e));
|
||||
}
|
||||
Task.Run(() => RunAction(e));
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyPressedEvent?.Invoke(this, new KeyPressedEventArgs(User32.HotKeyModifiers.MOD_NONE, e.KeyCode));
|
||||
KeyPressed?.Invoke(this, new KeyPressedEventArgs(User32.HotKeyModifiers.MOD_NONE, e.KeyCode));
|
||||
IsPressed = false;
|
||||
}
|
||||
}
|
||||
@@ -63,9 +50,9 @@ public class KeyboardHook
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
while (IsPressed && KeyPressedEvent != null)
|
||||
while (IsPressed)
|
||||
{
|
||||
KeyPressedEvent?.Invoke(this, new KeyPressedEventArgs(User32.HotKeyModifiers.MOD_NONE, e.KeyCode));
|
||||
KeyPressed?.Invoke(this, new KeyPressedEventArgs(User32.HotKeyModifiers.MOD_NONE, e.KeyCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,10 +62,6 @@ public class KeyboardHook
|
||||
if (e.KeyCode == BindKey)
|
||||
{
|
||||
IsPressed = false;
|
||||
if (SystemControl.IsGenshinImpactActive())
|
||||
{
|
||||
KeyUpEvent?.Invoke(this, new KeyPressedEventArgs(User32.HotKeyModifiers.MOD_NONE, e.KeyCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,4 +82,4 @@ public class KeyboardHook
|
||||
{
|
||||
UnregisterHotKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,6 @@ public class MouseHook
|
||||
|
||||
public event EventHandler<KeyPressedEventArgs>? MousePressed = null;
|
||||
|
||||
public event EventHandler<KeyPressedEventArgs>? MouseDownEvent = null;
|
||||
|
||||
public event EventHandler<KeyPressedEventArgs>? MouseUpEvent = null;
|
||||
|
||||
public bool IsHold { get; set; }
|
||||
|
||||
public MouseButtons BindMouse { get; set; } = MouseButtons.Left;
|
||||
@@ -35,7 +31,6 @@ public class MouseHook
|
||||
if (e.Button != MouseButtons.Left && e.Button != MouseButtons.None && e.Button == BindMouse)
|
||||
{
|
||||
IsPressed = true;
|
||||
MouseDownEvent?.Invoke(this, new KeyPressedEventArgs(User32.HotKeyModifiers.MOD_NONE, Keys.None));
|
||||
if (IsHold)
|
||||
{
|
||||
Task.Run(() => RunAction(e));
|
||||
@@ -68,10 +63,6 @@ public class MouseHook
|
||||
if (e.Button != MouseButtons.Left && e.Button != MouseButtons.None && e.Button == BindMouse)
|
||||
{
|
||||
IsPressed = false;
|
||||
if (SystemControl.IsGenshinImpactActive())
|
||||
{
|
||||
MouseUpEvent?.Invoke(this, new KeyPressedEventArgs(User32.HotKeyModifiers.MOD_NONE, Keys.None));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,4 +83,4 @@ public class MouseHook
|
||||
{
|
||||
UnregisterHotKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System;
|
||||
|
||||
namespace BetterGenshinImpact.Model;
|
||||
|
||||
@@ -11,13 +9,18 @@ namespace BetterGenshinImpact.Model;
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class Singleton<T> where T : class
|
||||
{
|
||||
private static T? _instance;
|
||||
private static object? syncRoot;
|
||||
// 使用Lazy<T>确保线程安全的延迟初始化
|
||||
private static readonly Lazy<T> _instance = new(() => CreateInstanceOfT()!, isThreadSafe: true);
|
||||
|
||||
public static T Instance => LazyInitializer.EnsureInitialized(ref _instance, ref syncRoot, CreateInstance);
|
||||
public static T Instance => _instance.Value;
|
||||
|
||||
private static T CreateInstance()
|
||||
// 保护的构造函数,防止直接实例化
|
||||
protected Singleton()
|
||||
{
|
||||
return (T)Activator.CreateInstance(typeof(T), true)!;
|
||||
}
|
||||
|
||||
private static T? CreateInstanceOfT()
|
||||
{
|
||||
return Activator.CreateInstance(typeof(T), true) as T;
|
||||
}
|
||||
}
|
||||
@@ -1,325 +1,324 @@
|
||||
[
|
||||
{
|
||||
"name": "荧",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "空",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "神里绫华",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "琴",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "丽莎",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "芭芭拉",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "凯亚",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "迪卢克",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "雷泽",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "安柏",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "温迪",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "香菱",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "北斗",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "行秋",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "魈",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "凝光",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "可莉",
|
||||
"scriptContent1": "keydown(w),wait(0.08),attack(0.05),keyup(w),wait(0.2)",
|
||||
"scriptContent2": "mousedown(left),mouseup(left),wait(0.09),charge(0.519),wait(0.09),charge(0.519),wait(0.09)"
|
||||
},
|
||||
{
|
||||
"name": "钟离",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "菲谢尔",
|
||||
"scriptContent1": "mousedown(left),wait(0.001),mouseup(left),wait(0.3),mousedown(left),wait(0.001),mouseup(left),wait(0.2),keydown(r),wait(0.02),keyup(r),wait(0.1),keydown(r),wait(0.02),keyup(r),wait(0.04)"
|
||||
},
|
||||
{
|
||||
"name": "班尼特",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "达达利亚",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "诺艾尔",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "七七",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "重云",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "甘雨",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "阿贝多",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "迪奥娜",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "莫娜",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "刻晴",
|
||||
"scriptContent1": "mousedown(left),wait(0.350),mouseup(left),wait(0.100)",
|
||||
"scriptContent2": "keydown(e),wait(0.085),keyup(e),wait(0.667),keydown(q),wait(0.081),keyup(q),wait(2.388),keydown(e),wait(0.085),keyup(e)"
|
||||
},
|
||||
{
|
||||
"name": "砂糖",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "辛焱",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "罗莎莉亚",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "胡桃",
|
||||
"scriptContent1": "charge(0.3),wait(0.1),dash,wait(0.1),charge(0.3),wait(0.1),dash,wait(0.1),charge(0.3),wait(0.1),j,wait(0.52)"
|
||||
},
|
||||
{
|
||||
"name": "枫原万叶",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "烟绯",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "宵宫",
|
||||
"scriptContent1": "e,wait(0.8),attack(1)",
|
||||
"scriptContent2": "mousedown(left),wait(0.001),mouseup(left),wait(0.218),mousedown(left),wait(0.001),mouseup(left),wait(0.219),mousedown(left),wait(0.25),mouseup(left),wait(0.206)"
|
||||
},
|
||||
{
|
||||
"name": "托马",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "优菈",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "雷电将军",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "早柚",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "珊瑚宫心海",
|
||||
"scriptContent1": "mousedown(left),wait(0.005),mouseup(left),wait(0.005),mousedown(left),wait(0.005),mouseup(left),wait(0.425),keydown(w),wait(0.225),keyup(w),wait(0.05)"
|
||||
},
|
||||
{
|
||||
"name": "五郎",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "九条裟罗",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "荒泷一斗",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "八重神子",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "鹿野院平藏",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "夜兰",
|
||||
"scriptContent1": "mousedown(left),wait(0.550),mouseup(left)"
|
||||
},
|
||||
{
|
||||
"name": "绮良良",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "埃洛伊",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "申鹤",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "云堇",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "久岐忍",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "神里绫人",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "柯莱",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "多莉",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "提纳里",
|
||||
"scriptContent1": "keydown(r),wait(0.005),keyup(r),wait(0.25),mousedown(left),wait(0.05),mouseup(left),wait(0.8),mousedown(left),wait(0.05),mouseup(left),wait(0.8),mousedown(left),wait(0.05),mouseup(left),wait(0.05),keydown(r),wait(0.005),keyup(r)"
|
||||
},
|
||||
{
|
||||
"name": "妮露",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "赛诺",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "坎蒂丝",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "纳西妲",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "莱依拉",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "流浪者",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "珐露珊",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "瑶瑶",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "艾尔海森",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "迪希雅",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "米卡",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "卡维",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "白术",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "琳妮特",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "林尼",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "菲米尼",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "莱欧斯利",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "那维莱特",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "夏洛蒂",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "芙宁娜",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "夏沃蕾",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "娜维娅",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "嘉明",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "闲云",
|
||||
"scriptContent1": ""
|
||||
}
|
||||
]
|
||||
{
|
||||
"name": "荧",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "空",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "神里绫华",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "琴",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "丽莎",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "芭芭拉",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "凯亚",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "迪卢克",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "雷泽",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "安柏",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "温迪",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "香菱",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "北斗",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "行秋",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "魈",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "凝光",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "可莉",
|
||||
"scriptContent1": "keydown(w),wait(0.08),attack(0.05),keyup(w),wait(0.2)",
|
||||
"scriptContent2": "mousedown(left),mouseup(left),wait(0.09),charge(0.519),wait(0.09),charge(0.519),wait(0.09)"
|
||||
},
|
||||
{
|
||||
"name": "钟离",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "菲谢尔",
|
||||
"scriptContent1": "mousedown(left),wait(0.001),mouseup(left),wait(0.218),mousedown(left),wait(0.001),mouseup(left),wait(0.219),mousedown(left),wait(0.25),mouseup(left),wait(0.206)"
|
||||
},
|
||||
{
|
||||
"name": "班尼特",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "达达利亚",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "诺艾尔",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "七七",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "重云",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "甘雨",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "阿贝多",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "迪奥娜",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "莫娜",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "刻晴",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "砂糖",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "辛焱",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "罗莎莉亚",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "胡桃",
|
||||
"scriptContent1": "charge(0.3),wait(0.1),dash,wait(0.1),charge(0.3),wait(0.1),dash,wait(0.1),charge(0.3),wait(0.1),j,wait(0.52)"
|
||||
},
|
||||
{
|
||||
"name": "枫原万叶",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "烟绯",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "宵宫",
|
||||
"scriptContent1": "e,wait(0.8),attack(7)",
|
||||
"scriptContent2": "mousedown(left),wait(0.001),mouseup(left),wait(0.218),mousedown(left),wait(0.001),mouseup(left),wait(0.219),mousedown(left),wait(0.25),mouseup(left),wait(0.206)"
|
||||
},
|
||||
{
|
||||
"name": "托马",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "优菈",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "雷电将军",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "早柚",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "珊瑚宫心海",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "五郎",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "九条裟罗",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "荒泷一斗",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "八重神子",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "鹿野院平藏",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "夜兰",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "绮良良",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "埃洛伊",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "申鹤",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "云堇",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "久岐忍",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "神里绫人",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "柯莱",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "多莉",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "提纳里",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "妮露",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "赛诺",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "坎蒂丝",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "纳西妲",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "莱依拉",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "流浪者",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "珐露珊",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "瑶瑶",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "艾尔海森",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "迪希雅",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "米卡",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "卡维",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "白术",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "琳妮特",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "林尼",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "菲米尼",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "莱欧斯利",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "那维莱特",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "夏洛蒂",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "芙宁娜",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "夏沃蕾",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "娜维娅",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "嘉明",
|
||||
"scriptContent1": ""
|
||||
},
|
||||
{
|
||||
"name": "闲云",
|
||||
"scriptContent1": ""
|
||||
}
|
||||
]
|
||||
@@ -342,7 +342,7 @@
|
||||
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
|
||||
<!-- 退出时最小化 -->
|
||||
<ui:CardControl Margin="0,0,0,12" Icon="{ui:SymbolIcon ArrowMinimize24}">
|
||||
<ui:CardControl.Header>
|
||||
@@ -351,23 +351,27 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<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:TextBlock
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
TextWrapping="Wrap"
|
||||
Text="退出时最小化到系统托盘" />
|
||||
<ui:TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
TextWrapping="Wrap"
|
||||
Text="启用后点击右上角退出按钮会最小化到系统托盘继续运行,右键托盘图标退出" />
|
||||
</Grid>
|
||||
</ui:CardControl.Header>
|
||||
<ui:ToggleSwitch Margin="0,0,36,0" IsChecked="{Binding Config.CommonConfig.ExitToTray, Mode=TwoWay}" />
|
||||
<ui:ToggleSwitch
|
||||
Margin="0,0,36,0"
|
||||
IsChecked="{Binding Config.CommonConfig.ExitToTray, Mode=TwoWay}" />
|
||||
</ui:CardControl>
|
||||
|
||||
<!-- 地图 -->
|
||||
<!--<ui:CardControl Margin="0,0,0,12" Icon="{ui:SymbolIcon Cursor24}">
|
||||
<ui:CardControl Margin="0,0,0,12" Icon="{ui:SymbolIcon Cursor24}">
|
||||
<ui:CardControl.Header>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
@@ -389,7 +393,7 @@
|
||||
<ui:Button Margin="0,0,36,0"
|
||||
Command="{Binding OpenMapViewerCommand}"
|
||||
Content="查看地图" />
|
||||
</ui:CardControl>-->
|
||||
</ui:CardControl>
|
||||
|
||||
<!--<ui:CardControl Margin="0,0,0,12" Icon="{ui:SymbolIcon Keyboard24}">
|
||||
<ui:CardControl.Header>
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="配置每个角色执行的战斗宏,修改需重启软件生效,比如:胡桃A重跳"
|
||||
Text="配置每个角色执行的战斗宏,重启软件后生效,比如:皇女滑步弓、胡桃A重跳"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:Button Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
@@ -116,18 +116,18 @@
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="角色选择使用的战斗宏编号"
|
||||
Text="角色战斗宏优先级"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="用于修改当前配置文件中哪个战斗宏是优先使用的(1~5)"
|
||||
Text="用于配置哪个战斗宏是优先使用的"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:NumberBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
Maximum="5"
|
||||
Maximum="1000"
|
||||
Minimum="1"
|
||||
ValidationMode="InvalidInputOverwritten"
|
||||
Value="{Binding Config.MacroConfig.CombatMacroPriority, Mode=TwoWay}" />
|
||||
|
||||
@@ -38,13 +38,16 @@
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="启用Webhook"
|
||||
Text="标准 Webhook 通知"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="Webhook相关设置"
|
||||
TextWrapping="Wrap" />
|
||||
TextWrapping="Wrap">
|
||||
发送 BetterGI 定义的
|
||||
标准请求
|
||||
到 Webhook 端点
|
||||
</ui:TextBlock>
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
@@ -65,12 +68,12 @@
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="Webhook端点"
|
||||
Text="Webhook 端点"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="填写Webhook端点"
|
||||
Text="通知地址"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
@@ -91,26 +94,292 @@
|
||||
<ColumnDefinition Width="2*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="测试"
|
||||
TextWrapping="Wrap" />
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="发送测试请求"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="发送测试载荷"
|
||||
TextWrapping="Wrap" />
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="发送请求到通知地址"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:Button Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,36,0"
|
||||
Content="发送"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{Binding TestWebhookCommand}"
|
||||
Content="发送"
|
||||
IsEnabled="{Binding IsLoading, Converter={StaticResource InverseBooleanConverter}}" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,36,0"
|
||||
HorizontalAlignment="Right"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="{Binding WebhookStatus}"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
<!-- Windows通知 -->
|
||||
<ui:CardExpander Margin="0,0,0,12"
|
||||
ContentPadding="0"
|
||||
Icon="{ui:SymbolIcon VirtualNetwork20}">
|
||||
<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"
|
||||
Text="Windows 通知"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
TextWrapping="Wrap">
|
||||
发送 Windows 通知,会在右下角弹框显示
|
||||
</ui:TextBlock>
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,24,0"
|
||||
IsChecked="{Binding Config.NotificationConfig.WebhookEnabled, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
</ui:CardExpander.Header>
|
||||
<StackPanel>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</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:Button Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{Binding TestWebhookCommand}"
|
||||
Content="发送"
|
||||
IsEnabled="{Binding IsLoading, Converter={StaticResource InverseBooleanConverter}}" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
HorizontalAlignment="Right"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="{Binding WebhookStatus}"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
<!-- 飞书 -->
|
||||
<ui:CardExpander Margin="0,0,0,12"
|
||||
ContentPadding="0"
|
||||
Icon="{ui:SymbolIcon VirtualNetwork20}">
|
||||
<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"
|
||||
Text="飞书机器人通知"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
TextWrapping="Wrap">
|
||||
通知到飞书机器人
|
||||
</ui:TextBlock>
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,24,0"
|
||||
IsChecked="{Binding Config.NotificationConfig.WebhookEnabled, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
</ui:CardExpander.Header>
|
||||
<StackPanel>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="飞书机器人 Webhook 地址"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="通知地址"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
MinWidth="180"
|
||||
MaxWidth="800"
|
||||
Margin="0,0,36,0"
|
||||
Text="{Binding Config.NotificationConfig.WebhookEndpoint, Mode=TwoWay}"
|
||||
TextWrapping="NoWrap" />
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</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:Button Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{Binding TestWebhookCommand}"
|
||||
Content="发送"
|
||||
IsEnabled="{Binding IsLoading, Converter={StaticResource InverseBooleanConverter}}" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
HorizontalAlignment="Right"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="{Binding WebhookStatus}"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
<!-- 钉钉 -->
|
||||
<ui:CardExpander Margin="0,0,0,12"
|
||||
ContentPadding="0"
|
||||
Icon="{ui:SymbolIcon VirtualNetwork20}">
|
||||
<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"
|
||||
Text="钉钉机器人通知"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
TextWrapping="Wrap">
|
||||
通知到钉钉机器人
|
||||
</ui:TextBlock>
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,24,0"
|
||||
IsChecked="{Binding Config.NotificationConfig.WebhookEnabled, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
</ui:CardExpander.Header>
|
||||
<StackPanel>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="Webhook 地址"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="通知地址"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
MinWidth="180"
|
||||
MaxWidth="800"
|
||||
Margin="0,0,36,0"
|
||||
Text="{Binding Config.NotificationConfig.WebhookEndpoint, Mode=TwoWay}"
|
||||
TextWrapping="NoWrap" />
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="3*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</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:Button Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{Binding TestWebhookCommand}"
|
||||
Content="发送"
|
||||
IsEnabled="{Binding IsLoading, Converter={StaticResource InverseBooleanConverter}}" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
HorizontalAlignment="Right"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="{Binding WebhookStatus}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
TextWrapping="Wrap">
|
||||
全自动打牌 -<Hyperlink Command="{Binding GoToAutoGeniusInvokationUrlCommand}" Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
|
||||
全自动打牌 -<Hyperlink Command="{Binding GoToAutoGeniusInvokationUrlCommand}">
|
||||
点击查看使用教程
|
||||
</Hyperlink>
|
||||
</ui:TextBlock>
|
||||
|
||||
@@ -201,19 +201,18 @@
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="选择选项配置"
|
||||
Text="启用默认选择第一个选项"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="优先选择第一个选项、选择最后一个选项、不选择选项"
|
||||
Text="未启用时默认选择最后一个选项"
|
||||
TextWrapping="Wrap" />
|
||||
<ComboBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
ItemsSource="{Binding ClickChatOptionNames}"
|
||||
SelectedItem="{Binding Config.AutoSkipConfig.ClickChatOption, Mode=TwoWay}" />
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,36,0"
|
||||
IsChecked="{Binding Config.AutoSkipConfig.ClickFirstOptionEnabled, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
@@ -320,7 +319,7 @@
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="自动邀约(仅支持1920x1080)"
|
||||
Text="自动邀约(实验功能)"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
@@ -347,7 +346,7 @@
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="选择进行的邀约(由于无人提供数据,此功能暂停开发)"
|
||||
Text="选择进行的邀约(数据收集中)"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
@@ -359,7 +358,7 @@
|
||||
Grid.Column="1"
|
||||
MinWidth="90"
|
||||
Margin="0,0,24,0"
|
||||
Text="无数据" />
|
||||
Text="开发中..." />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
using BetterGenshinImpact.Helpers.Extensions;
|
||||
@@ -318,18 +317,6 @@ public partial class HotKeyPageViewModel : ObservableObject, IViewModel
|
||||
}
|
||||
}
|
||||
));
|
||||
|
||||
HotKeySettingModels.Add(new HotKeySettingModel(
|
||||
"一键战斗宏快捷键",
|
||||
nameof(Config.HotKeyConfig.OneKeyFightHotkey),
|
||||
Config.HotKeyConfig.OneKeyFightHotkey,
|
||||
Config.HotKeyConfig.OneKeyFightHotkeyType,
|
||||
null,
|
||||
true)
|
||||
{
|
||||
OnKeyDownAction = (_, _) => { OneKeyFightTask.Instance.KeyDown(); },
|
||||
OnKeyUpAction = (_, _) => { OneKeyFightTask.Instance.KeyUp(); }
|
||||
});
|
||||
}
|
||||
|
||||
private string ToChinese(bool enabled)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
using BetterGenshinImpact.Service.Interface;
|
||||
using BetterGenshinImpact.View.Pages;
|
||||
using BetterGenshinImpact.View.Windows;
|
||||
@@ -18,7 +17,7 @@ public partial class MacroSettingsPageViewModel : ObservableObject, INavigationA
|
||||
private readonly INavigationService _navigationService;
|
||||
|
||||
[ObservableProperty]
|
||||
private string[] _quickFightMacroHotkeyMode = [OneKeyFightTask.HoldOnMode, OneKeyFightTask.TickMode];
|
||||
private string[] _quickFightMacroHotkeyMode = ["按住时重复", "触发"];
|
||||
|
||||
public MacroSettingsPageViewModel(IConfigService configService, INavigationService navigationService)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@ using BetterGenshinImpact.View.Pages;
|
||||
using BetterGenshinImpact.View.Windows;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Fischless.GameCapture;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using Wpf.Ui;
|
||||
@@ -14,9 +13,6 @@ namespace BetterGenshinImpact.ViewModel.Pages;
|
||||
|
||||
public partial class TriggerSettingsPageViewModel : ObservableObject, INavigationAware, IViewModel
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string[] _clickChatOptionNames = ["优先选择第一个选项", "优先选择最后一个选项", "不选择选项"];
|
||||
|
||||
public AllConfig Config { get; set; }
|
||||
|
||||
private readonly INavigationService _navigationService;
|
||||
|
||||
Reference in new issue
Block a user