mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-04-26 22:39:47 +08:00
Merge remote-tracking branch 'origin/main' into iris-dev
This commit is contained in:
@@ -157,8 +157,11 @@ public class MapPuzzle
|
||||
Debug.WriteLine("");
|
||||
}
|
||||
|
||||
// 地图图片块
|
||||
SaveImagesAs1024X1024(arr, imageLocations, @"E:\HuiTask\更好的原神\地图匹配\有用的素材\5.0\地图块", minRow, minCol);
|
||||
|
||||
// 保存大图
|
||||
Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\map_50_2048.png", largeImage);
|
||||
// Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\map_50_2048.png", largeImage);
|
||||
// Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\combined_image_sd4x.png", largeImage.Resize(new Size(largeImage.Width / 4, largeImage.Height / 4), 0, 0, InterpolationFlags.Cubic));
|
||||
// Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\combined_image_small.png", largeImage.Resize(new Size(1400, 1300), 0, 0, InterpolationFlags.Cubic));
|
||||
|
||||
@@ -170,6 +173,36 @@ public class MapPuzzle
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveImagesAs1024X1024(int[,] arr, Dictionary<(int row, int col), ImgInfo> imageLocations, string outputFolder, int minRow, int minCol)
|
||||
{
|
||||
if (!Directory.Exists(outputFolder))
|
||||
{
|
||||
Directory.CreateDirectory(outputFolder);
|
||||
}
|
||||
|
||||
for (int row = 0; row < arr.GetLength(0); row++)
|
||||
{
|
||||
for (int col = 0; col < arr.GetLength(1); col++)
|
||||
{
|
||||
if (arr[row, col] == 1)
|
||||
{
|
||||
var key = (row + minRow, col + minCol);
|
||||
if (imageLocations.TryGetValue(key, out var imgInfo))
|
||||
{
|
||||
var img = imgInfo.Img;
|
||||
if (img.Width != 1204 || img.Height != 1204)
|
||||
{
|
||||
img = imgInfo.Img.Resize(new Size(1024, 1024), 0, 0, InterpolationFlags.Nearest);
|
||||
}
|
||||
var outputPath = Path.Combine(outputFolder, $"{row}_{col}.png");
|
||||
Cv2.ImWrite(outputPath, img);
|
||||
img.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ImgInfo
|
||||
{
|
||||
public Mat Img { get; set; }
|
||||
|
||||
@@ -13,11 +13,11 @@ public class MapTeleportPointDraw
|
||||
{
|
||||
public static void Draw()
|
||||
{
|
||||
var pList = LoadTeleportPoint(@"E:\HuiTask\更好的原神\地图匹配\地图点位\5.0");
|
||||
pList.AddRange(MapAssets.Instance.TpPositions);
|
||||
// var pList = LoadTeleportPoint(@"E:\HuiTask\更好的原神\地图匹配\地图点位\5.0");
|
||||
// pList.AddRange(MapAssets.Instance.TpPositions);
|
||||
var map = new Mat(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\5.0\mainMap1024BlockColor.png");
|
||||
DrawTeleportPoint(map, pList);
|
||||
Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\5.0\mainMap1024BlockColor_传送点.png", map);
|
||||
DrawTeleportPoint(map, MapAssets.Instance.TpPositions);
|
||||
Cv2.ImWrite(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\5.0\传送点_1024_0.34.3.png", map);
|
||||
}
|
||||
|
||||
public static void DrawTeleportPoint(Mat map, List<GiWorldPosition> points)
|
||||
|
||||
@@ -21,6 +21,7 @@ using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
|
||||
namespace BetterGenshinImpact;
|
||||
|
||||
@@ -240,7 +241,23 @@ public partial class App : Application
|
||||
e = e.InnerException;
|
||||
}
|
||||
|
||||
System.Windows.Forms.MessageBox.Show("程序异常:" + e.Source + "\r\n--" + Environment.NewLine + e.StackTrace + "\r\n---" + Environment.NewLine + e.Message);
|
||||
try
|
||||
{
|
||||
ExceptionReport.Show(e);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Fallback.
|
||||
System.Windows.Forms.MessageBox.Show(
|
||||
$"""
|
||||
程序异常:{e.Source}
|
||||
--
|
||||
{e.StackTrace}
|
||||
--
|
||||
{e.Message}
|
||||
"""
|
||||
);
|
||||
}
|
||||
|
||||
// log
|
||||
GetLogger<App>().LogDebug(e, "UnHandle Exception");
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ApplicationIcon>Assets\logo.ico</ApplicationIcon>
|
||||
<AssemblyName>BetterGI</AssemblyName>
|
||||
<AssemblyVersion>0.34.2</AssemblyVersion>
|
||||
<Platforms>x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -61,7 +62,7 @@
|
||||
<PackageReference Include="Vanara.PInvoke.User32" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI" Version="3.0.5" />
|
||||
<PackageReference Include="WPF-UI.Tray" Version="3.0.5" />
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="3.0.5.10" />
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="3.0.5.12" />
|
||||
<PackageReference Include="YoloV8" Version="4.1.7" />
|
||||
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
@@ -7,7 +8,7 @@ namespace BetterGenshinImpact.Core.Config;
|
||||
|
||||
public class Global
|
||||
{
|
||||
public static string Version { get; } = "0.34.1";
|
||||
public static string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version!.ToString(3);
|
||||
|
||||
public static string StartUpPath { get; set; } = AppContext.BaseDirectory;
|
||||
|
||||
|
||||
@@ -628,7 +628,7 @@ public class AutoDomainTask
|
||||
continuousCount++;
|
||||
}
|
||||
|
||||
if (angle < 180)
|
||||
if (angle <= 180)
|
||||
{
|
||||
// 左移视角
|
||||
var moveAngle = angle;
|
||||
|
||||
@@ -5,6 +5,8 @@ namespace BetterGenshinImpact.GameTask.AutoPathing.Model.Enum;
|
||||
public class ActionEnum(string code, string msg)
|
||||
{
|
||||
public static readonly ActionEnum StopFlying = new("stop_flying", "下落攻击");
|
||||
public static readonly ActionEnum ForceTp = new("force_tp", "当前点传送");
|
||||
|
||||
// 还有要加入的其他动作
|
||||
// 滚轮F
|
||||
// 触发自动战斗任务
|
||||
|
||||
@@ -23,6 +23,12 @@ public class Navigation
|
||||
TaskControl.Logger.LogInformation("地图特征点加载完成!");
|
||||
}
|
||||
_isWarmUp = true;
|
||||
Reset();
|
||||
}
|
||||
|
||||
public static void Reset()
|
||||
{
|
||||
EntireMap.Instance.SetPrevPosition(-1, -1);
|
||||
}
|
||||
|
||||
public static Point2f GetPosition(ImageRegion imageRegion)
|
||||
|
||||
@@ -99,7 +99,8 @@ public class PathExecutor(CancellationTokenSource cts)
|
||||
|
||||
private async Task HandleTeleportWaypoint(Waypoint waypoint)
|
||||
{
|
||||
var (tpX, tpY) = await new TpTask(cts).Tp(waypoint.X, waypoint.Y);
|
||||
var forceTp = waypoint.Action == ActionEnum.ForceTp.Code;
|
||||
var (tpX, tpY) = await new TpTask(cts).Tp(waypoint.X, waypoint.Y, forceTp);
|
||||
var (tprX, tprY) = MapCoordinate.GameToMain2048(tpX, tpY);
|
||||
EntireMap.Instance.SetPrevPosition((float)tprX, (float)tprY); // 通过上一个位置直接进行局部特征匹配
|
||||
}
|
||||
|
||||
@@ -3,17 +3,23 @@ using BetterGenshinImpact.GameTask.AutoPathing.Model;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Model.Enum;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.GameTask.Common.Map;
|
||||
using BetterGenshinImpact.View.Controls.Webview;
|
||||
using BetterGenshinImpact.ViewModel.Pages;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Windows;
|
||||
using BetterGenshinImpact.Model;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoPathing;
|
||||
|
||||
public class PathRecorder
|
||||
public class PathRecorder : Singleton<PathRecorder>
|
||||
{
|
||||
private WebpageWindow? _webWindow;
|
||||
|
||||
public static readonly JsonSerializerOptions JsonOptions = new()
|
||||
{
|
||||
NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals,
|
||||
@@ -28,6 +34,7 @@ public class PathRecorder
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Navigation.WarmUp();
|
||||
_pathingTask = new PathingTask();
|
||||
TaskControl.Logger.LogInformation("开始路径点记录");
|
||||
var waypoint = new Waypoint();
|
||||
@@ -39,7 +46,15 @@ public class PathRecorder
|
||||
waypoint.Type = WaypointType.Teleport.Code;
|
||||
waypoint.MoveMode = MoveModeEnum.Walk.Code;
|
||||
_pathingTask.Positions.Add(waypoint);
|
||||
TaskControl.Logger.LogInformation("已创建初始路径点({x},{y})", waypoint.X, waypoint.Y);
|
||||
if (_webWindow == null)
|
||||
{
|
||||
TaskControl.Logger.LogInformation("已创建初始路径点({x},{y})", waypoint.X, waypoint.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskControl.Logger.LogInformation("已添加途径点({x},{y})", waypoint.X, waypoint.Y);
|
||||
AddPosToEditor(waypoint.X, waypoint.Y);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddWaypoint(string waypointType = "")
|
||||
@@ -51,27 +66,55 @@ public class PathRecorder
|
||||
waypoint.X = position.X;
|
||||
waypoint.Y = position.Y;
|
||||
waypoint.Type = string.IsNullOrEmpty(waypointType) ? WaypointType.Path.Code : waypointType;
|
||||
// var motionStatus = Bv.GetMotionStatus(screen);
|
||||
// switch (motionStatus)
|
||||
// {
|
||||
// case MotionStatus.Fly:
|
||||
// waypoint.MoveStatus = MoveStatusType.Fly.Code;
|
||||
// break;
|
||||
//
|
||||
// case MotionStatus.Climb:
|
||||
// waypoint.MoveStatus = MoveStatusType.Jump.Code;
|
||||
// break;
|
||||
//
|
||||
// default:
|
||||
// waypoint.MoveStatus = MoveStatusType.Walk.Code;
|
||||
// break;
|
||||
// }
|
||||
_pathingTask.Positions.Add(waypoint);
|
||||
TaskControl.Logger.LogInformation("已添加途径点({x},{y})", waypoint.X, waypoint.Y);
|
||||
AddPosToEditor(waypoint.X, waypoint.Y);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
_pathingTask.SaveToFile(Path.Combine(MapPathingViewModel.PathJsonPath, $@"{DateTime.Now:yyyy-MM-dd HH:mm:ss:ffff}.json"));
|
||||
if (_webWindow == null)
|
||||
{
|
||||
var name = $@"{DateTime.Now:yyyyMMdd_HHmmss}.json";
|
||||
_pathingTask.SaveToFile(Path.Combine(MapPathingViewModel.PathJsonPath, name));
|
||||
TaskControl.Logger.LogInformation("录制编辑器未打开,直接保存路径点记录:{Name}", name);
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskControl.Logger.LogInformation("路径点记录结束,请在录制编辑器中查看并编辑结果");
|
||||
TaskControl.Logger.LogInformation("如果要重新录制新的路径,请在录制编辑器中删除已有路径或创建新的路径");
|
||||
TaskControl.Logger.LogInformation("修改完毕后请务必记得导出路径!");
|
||||
}
|
||||
}
|
||||
|
||||
public void AddPosToEditor(double x, double y)
|
||||
{
|
||||
if (_webWindow != null)
|
||||
{
|
||||
_webWindow.WebView.ExecuteScriptAsync($"addNewPoint({x},{y})");
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenEditorInWebView()
|
||||
{
|
||||
if (_webWindow is not { IsVisible: true })
|
||||
{
|
||||
_webWindow = new WebpageWindow
|
||||
{
|
||||
Title = "地图路径点编辑器",
|
||||
Width = 1366,
|
||||
Height = 768,
|
||||
// Owner = Application.Current.MainWindow,
|
||||
WindowState = WindowState.Maximized
|
||||
};
|
||||
_webWindow.Closed += (s, e) => _webWindow = null;
|
||||
_webWindow.Panel!.DownloadFolderPath = MapPathingViewModel.PathJsonPath;
|
||||
_webWindow.NavigateToFile(Global.Absolute(@"Assets\Map\Editor\index.html"));
|
||||
_webWindow.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
_webWindow.Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -33,11 +33,17 @@ public class TpTask(CancellationTokenSource cts)
|
||||
/// </summary>
|
||||
/// <param name="tpX"></param>
|
||||
/// <param name="tpY"></param>
|
||||
public async Task<(double, double)> Tp(double tpX, double tpY)
|
||||
/// <param name="force">强制以当前的tpX,tpY坐标进行自动传送</param>
|
||||
public async Task<(double, double)> TpOnce(double tpX, double tpY, bool force = false)
|
||||
{
|
||||
// 获取最近的传送点位置
|
||||
var (x, y) = GetRecentlyTpPoint(tpX, tpY);
|
||||
Logger.LogInformation("({TpX},{TpY}) 最近的传送点位置 ({X},{Y})", $"{tpX:F1}", $"{tpY:F1}", $"{x:F1}", $"{y:F1}");
|
||||
var (x, y) = (tpX, tpY);
|
||||
|
||||
if (!force)
|
||||
{
|
||||
// 获取最近的传送点位置
|
||||
(x, y) = GetRecentlyTpPoint(tpX, tpY);
|
||||
Logger.LogInformation("({TpX},{TpY}) 最近的传送点位置 ({X},{Y})", $"{tpX:F1}", $"{tpY:F1}", $"{x:F1}", $"{y:F1}");
|
||||
}
|
||||
|
||||
// M 打开地图识别当前位置,中心点为当前位置
|
||||
using var ra1 = CaptureToRectArea();
|
||||
@@ -52,12 +58,14 @@ public class TpTask(CancellationTokenSource cts)
|
||||
|
||||
// 计算坐标后点击
|
||||
var bigMapInAllMapRect = GetBigMapRect();
|
||||
bigMapInAllMapRect = bigMapInAllMapRect.Shrink(115);
|
||||
while (!bigMapInAllMapRect.Contains(x, y))
|
||||
{
|
||||
Debug.WriteLine($"({x},{y}) 不在 {bigMapInAllMapRect} 内,继续移动");
|
||||
Logger.LogInformation("传送点不在当前大地图范围内,继续移动");
|
||||
await MoveMapTo(x, y);
|
||||
bigMapInAllMapRect = GetBigMapRect();
|
||||
bigMapInAllMapRect = bigMapInAllMapRect.Shrink(115);
|
||||
}
|
||||
|
||||
// Debug.WriteLine($"({x},{y}) 在 {bigMapInAllMapRect} 内,计算它在窗体内的位置");
|
||||
@@ -91,6 +99,23 @@ public class TpTask(CancellationTokenSource cts)
|
||||
return (x, y);
|
||||
}
|
||||
|
||||
public async Task<(double, double)> Tp(double tpX, double tpY, bool force = false)
|
||||
{
|
||||
// 重试3次
|
||||
for (var i = 0; i < 3; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await TpOnce(tpX, tpY, force);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e, "传送失败,重试 {I} 次", i + 1);
|
||||
}
|
||||
}
|
||||
throw new InvalidOperationException("传送失败");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移动地图到指定传送点位置
|
||||
/// 可能会移动不对,所以可以重试此方法
|
||||
@@ -179,6 +204,18 @@ public class TpTask(CancellationTokenSource cts)
|
||||
return GetBigMapCenterPoint();
|
||||
}
|
||||
|
||||
public Point2f? GetPositionFromBigMapNullable()
|
||||
{
|
||||
try
|
||||
{
|
||||
return GetBigMapCenterPoint();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Rect GetBigMapRect()
|
||||
{
|
||||
var rect = new Rect();
|
||||
@@ -202,7 +239,7 @@ public class TpTask(CancellationTokenSource cts)
|
||||
{
|
||||
throw new RetryException("当前不在地图界面");
|
||||
}
|
||||
}, TimeSpan.FromMilliseconds(500), 10);
|
||||
}, TimeSpan.FromMilliseconds(500), 5);
|
||||
|
||||
if (rect == Rect.Empty)
|
||||
{
|
||||
@@ -272,10 +309,16 @@ public class TpTask(CancellationTokenSource cts)
|
||||
}
|
||||
|
||||
// 识别当前位置
|
||||
var bigMapCenterPoint = GetPositionFromBigMap();
|
||||
Logger.LogInformation("识别当前位置:{Pos}", bigMapCenterPoint);
|
||||
var minDistance = double.MaxValue;
|
||||
var bigMapCenterPointNullable = GetPositionFromBigMapNullable();
|
||||
|
||||
if (bigMapCenterPointNullable != null)
|
||||
{
|
||||
var bigMapCenterPoint = bigMapCenterPointNullable.Value;
|
||||
Logger.LogInformation("识别当前大地图位置:{Pos}", bigMapCenterPoint);
|
||||
minDistance = Math.Sqrt(Math.Pow(bigMapCenterPoint.X - x, 2) + Math.Pow(bigMapCenterPoint.Y - y, 2));
|
||||
}
|
||||
|
||||
var minDistance = Math.Sqrt(Math.Pow(bigMapCenterPoint.X - x, 2) + Math.Pow(bigMapCenterPoint.Y - y, 2));
|
||||
var minCountry = "当前位置";
|
||||
foreach (var (country, position) in MapAssets.Instance.CountryPositions)
|
||||
{
|
||||
|
||||
@@ -17,6 +17,6 @@ public class WoodTaskParam : BaseTaskParam
|
||||
}
|
||||
|
||||
WoodDailyMaxCount = woodDailyMaxCount;
|
||||
if (WoodDailyMaxCount is 0 or >= 2000) WoodDailyMaxCount = 2000;
|
||||
if (WoodDailyMaxCount is 0 or >= 9999) WoodDailyMaxCount = 9999;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,22 @@ public static class RectExtension
|
||||
{
|
||||
return (rect.X <= x && rect.Y <= y && rect.X + rect.Width > x && rect.Y + rect.Height > y);
|
||||
}
|
||||
|
||||
public static Rect Shrink(this Rect rect, int shrinkAmount)
|
||||
{
|
||||
rect.X += shrinkAmount;
|
||||
rect.Y += shrinkAmount;
|
||||
rect.Width -= 2 * shrinkAmount;
|
||||
rect.Height -= 2 * shrinkAmount;
|
||||
return rect;
|
||||
}
|
||||
|
||||
public static Rect Shrink(this Rect rect, int shrinkWidth, int shrinkHeight)
|
||||
{
|
||||
rect.X += shrinkWidth;
|
||||
rect.Y += shrinkHeight;
|
||||
rect.Width -= 2 * shrinkWidth;
|
||||
rect.Height -= 2 * shrinkHeight;
|
||||
return rect;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using BetterGenshinImpact.ViewModel.Pages;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using Microsoft.Web.WebView2.Wpf;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
@@ -16,6 +17,10 @@ public class WebpagePanel : UserControl
|
||||
private WebView2 _webView = null!;
|
||||
private bool _initialized = false;
|
||||
|
||||
public WebView2 WebView => _webView;
|
||||
|
||||
public string? DownloadFolderPath { get; set; }
|
||||
|
||||
public WebpagePanel()
|
||||
{
|
||||
if (!IsWebView2Available())
|
||||
@@ -43,6 +48,10 @@ public class WebpagePanel : UserControl
|
||||
if (e.IsSuccess)
|
||||
{
|
||||
_initialized = true;
|
||||
if (!string.IsNullOrEmpty(DownloadFolderPath))
|
||||
{
|
||||
WebView.CoreWebView2.Profile.DefaultDownloadFolderPath = DownloadFolderPath;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Microsoft.Web.WebView2.Wpf;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace BetterGenshinImpact.View.Controls.Webview;
|
||||
|
||||
public class WebpageWindow : Window
|
||||
{
|
||||
public WebpagePanel? Webview => Content as WebpagePanel;
|
||||
public WebpagePanel? Panel => Content as WebpagePanel;
|
||||
|
||||
public WebView2 WebView => Panel!.WebView;
|
||||
|
||||
public WebpageWindow()
|
||||
{
|
||||
@@ -43,11 +46,16 @@ public class WebpageWindow : Window
|
||||
|
||||
public void NavigateToUri(Uri uri)
|
||||
{
|
||||
Webview?.NavigateToUri(uri);
|
||||
Panel?.NavigateToUri(uri);
|
||||
}
|
||||
|
||||
public void NavigateToHtml(string html)
|
||||
{
|
||||
Webview?.NavigateToHtml(html);
|
||||
Panel?.NavigateToHtml(html);
|
||||
}
|
||||
|
||||
public void NavigateToFile(string path)
|
||||
{
|
||||
Panel?.NavigateToFile(path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,8 +72,11 @@
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="在遮罩内显示日志窗口"
|
||||
TextWrapping="Wrap" />
|
||||
TextWrapping="Wrap">
|
||||
在遮罩内显示日志窗口,<Hyperlink Command="{Binding GoToLogFolderCommand}" Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
|
||||
点击打开日志文件夹
|
||||
</Hyperlink>
|
||||
</ui:TextBlock>
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
|
||||
@@ -106,6 +106,9 @@
|
||||
<MenuItem Command="{Binding StartRunCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.SelectedItem}"
|
||||
Header="执行脚本" />
|
||||
<MenuItem Command="{Binding RefreshCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.SelectedItem}"
|
||||
Header="刷新" />
|
||||
</ContextMenu>
|
||||
</ListBox.ContextMenu>
|
||||
<ListView.Style>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
TextWrapping="Wrap">
|
||||
可以实现自动采集(尝鲜)、自动挖矿(开发中)、自动锄地(开发中)等功能。建议在调度器中使用!<Hyperlink Command="{Binding GoToPathingUrlCommand}" Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
|
||||
点击查看地图追踪使用教程
|
||||
点击查看地图追踪与录制使用教程
|
||||
</Hyperlink>
|
||||
</ui:TextBlock>
|
||||
|
||||
@@ -53,6 +53,9 @@
|
||||
<ui:Button Margin="10,0,0,0"
|
||||
Command="{Binding OpenMapViewerCommand}"
|
||||
Content="查看实时追踪地图" />
|
||||
<ui:Button Margin="10,0,0,0"
|
||||
Command="{Binding OpenMapEditorCommand}"
|
||||
Content="打开录制编辑器" />
|
||||
</StackPanel>
|
||||
|
||||
<Separator Grid.Row="3"
|
||||
@@ -103,6 +106,9 @@
|
||||
<MenuItem Command="{Binding StartCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.SelectedItem}"
|
||||
Header="执行任务" />
|
||||
<MenuItem Command="{Binding RefreshCommand}"
|
||||
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}, Path=PlacementTarget.SelectedItem}"
|
||||
Header="刷新" />
|
||||
</ContextMenu>
|
||||
</ListBox.ContextMenu>
|
||||
<ListView.Style>
|
||||
|
||||
@@ -598,9 +598,7 @@
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
TextWrapping="Wrap">
|
||||
基于 YOLOv8 的鱼类识别。帮助进行AI训练 Q群:<Hyperlink Command="{Binding GoToQGroupUrlCommand}" Foreground="{ui:ThemeResource TextFillColorSecondaryBrush}">
|
||||
863012276
|
||||
</Hyperlink>
|
||||
基于 YOLOv8 的鱼类识别
|
||||
</ui:TextBlock>
|
||||
<ui:ToggleSwitch Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
|
||||
@@ -84,4 +84,4 @@ namespace BetterGenshinImpact.View
|
||||
public string Name { get; set; }
|
||||
public IntPtr Handle { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
ExtendsContentIntoTitleBar="True"
|
||||
FontFamily="{DynamicResource TextThemeFontFamily}"
|
||||
Tag="JsonMonoDialog"
|
||||
WindowBackdropType="Mica"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using BetterGenshinImpact.ViewModel.Windows;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace BetterGenshinImpact.View.Windows;
|
||||
@@ -19,28 +17,6 @@ public partial class JsonMonoDialog : FluentWindow
|
||||
JsonCodeBox.TextChanged += (_, _) => ViewModel.JsonText = JsonCodeBox.Text;
|
||||
}
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
{
|
||||
base.OnSourceInitialized(e);
|
||||
TryApplySystemBackdrop();
|
||||
}
|
||||
|
||||
private void TryApplySystemBackdrop()
|
||||
{
|
||||
if (WindowBackdrop.IsSupported(WindowBackdropType.Mica))
|
||||
{
|
||||
Background = new SolidColorBrush(Colors.Transparent);
|
||||
WindowBackdrop.ApplyBackdrop(this, WindowBackdropType.Mica);
|
||||
return;
|
||||
}
|
||||
|
||||
if (WindowBackdrop.IsSupported(WindowBackdropType.Tabbed))
|
||||
{
|
||||
Background = new SolidColorBrush(Colors.Transparent);
|
||||
WindowBackdrop.ApplyBackdrop(this, WindowBackdropType.Tabbed);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Show(string path)
|
||||
{
|
||||
JsonMonoDialog dialog = new(path)
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
FontFamily="{DynamicResource TextThemeFontFamily}"
|
||||
ResizeMode="CanMinimize"
|
||||
Topmost="True"
|
||||
WindowBackdropType="Mica"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
WindowStyle="SingleBorderWindow"
|
||||
mc:Ignorable="d">
|
||||
|
||||
@@ -70,4 +70,16 @@ public partial class CommonSettingsPageViewModel : ObservableObject, INavigation
|
||||
|
||||
Process.Start("explorer.exe", path);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void OnGoToLogFolder()
|
||||
{
|
||||
var path = Global.Absolute(@"log");
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
|
||||
Process.Start("explorer.exe", path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ public partial class HotKeyPageViewModel : ObservableObject, IViewModel
|
||||
}
|
||||
));
|
||||
|
||||
var pathRecorder = new PathRecorder();
|
||||
var pathRecorder = PathRecorder.Instance;
|
||||
var pathRecording = false;
|
||||
|
||||
HotKeySettingModels.Add(new HotKeySettingModel(
|
||||
@@ -460,7 +460,6 @@ public partial class HotKeyPageViewModel : ObservableObject, IViewModel
|
||||
Config.HotKeyConfig.AutoTrackPathHotkeyType,
|
||||
(_, _) => { _taskSettingsPageViewModel.OnSwitchAutoTrackPath(); }
|
||||
));
|
||||
|
||||
HotKeySettingModels.Add(new HotKeySettingModel(
|
||||
"(测试)测试",
|
||||
nameof(Config.HotKeyConfig.Test1Hotkey),
|
||||
@@ -468,11 +467,9 @@ public partial class HotKeyPageViewModel : ObservableObject, IViewModel
|
||||
Config.HotKeyConfig.Test1HotkeyType,
|
||||
(_, _) =>
|
||||
{
|
||||
var p = new TpTask(new CancellationTokenSource()).GetPositionFromBigMap();
|
||||
_logger.LogInformation("大地图位置:{Position}", p);
|
||||
// pathRecorder.OpenEditorInWebView();
|
||||
}
|
||||
));
|
||||
|
||||
HotKeySettingModels.Add(new HotKeySettingModel(
|
||||
"(测试)测试2",
|
||||
nameof(Config.HotKeyConfig.Test2Hotkey),
|
||||
|
||||
@@ -14,6 +14,7 @@ using BetterGenshinImpact.Core.Script.Group;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.Controls;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Model;
|
||||
|
||||
namespace BetterGenshinImpact.ViewModel.Pages;
|
||||
|
||||
@@ -81,11 +82,7 @@ public partial class JsListViewModel : ObservableObject, INavigationAware, IView
|
||||
[RelayCommand]
|
||||
public void OnOpenScriptProjectFolder(ScriptProject? item)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Process.Start("explorer.exe", item.ProjectPath);
|
||||
Process.Start("explorer.exe", item == null ? scriptPath : item.ProjectPath);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
@@ -97,4 +94,10 @@ public partial class JsListViewModel : ObservableObject, INavigationAware, IView
|
||||
}
|
||||
await _scriptService.RunMulti([new ScriptGroupProject(item)]);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void OnRefresh(ScriptProject? item)
|
||||
{
|
||||
InitScriptListViewData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,9 +126,21 @@ public partial class MapPathingViewModel(IScriptService scriptService) : Observa
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void OnOpenMapEditor()
|
||||
{
|
||||
PathRecorder.Instance.OpenEditorInWebView();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void OnGoToPathingUrl()
|
||||
{
|
||||
Process.Start(new ProcessStartInfo("https://bgi.huiyadan.com/autos/pathing.html") { UseShellExecute = true });
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void OnRefresh(PathingTask? item)
|
||||
{
|
||||
InitScriptListViewData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ public partial class ScriptControlViewModel : ObservableObject, INavigationAware
|
||||
if (grandChild is CheckBox checkBox && checkBox.IsChecked == true)
|
||||
{
|
||||
var fileInfo = (FileInfo)checkBox.Tag;
|
||||
SelectedScriptGroup?.Projects.Add(ScriptGroupProject.BuildPathingProject(fileInfo.Name, fileInfo.DirectoryName));
|
||||
SelectedScriptGroup?.Projects.Add(ScriptGroupProject.BuildPathingProject(fileInfo.Name, fileInfo.Directory!.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,16 +6,11 @@ mkdir dist\BetterGI
|
||||
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath`) do set "path=%path%;%%i\MSBuild\Current\Bin;%%i\Common7\IDE"
|
||||
|
||||
@echo [prepare version]
|
||||
cd /d ..\BetterGenshinImpact\Core\Config
|
||||
set "script=Get-Content 'Global.cs' ^| Select-String -Pattern 'Version.*\"(.*)\"' ^| ForEach-Object { $_.Matches.Groups[1].Value }"
|
||||
|
||||
for /f "usebackq delims=" %%i in (`powershell -NoLogo -NoProfile -Command ^"%script%^"`) do set version=%%i
|
||||
|
||||
echo currnet version is %version%
|
||||
|
||||
if "%b%"=="" (
|
||||
set "b=%version%"
|
||||
)
|
||||
cd /d ..\BetterGenshinImpact
|
||||
set "script=Get-Content 'BetterGenshinImpact.csproj' | Select-String -Pattern 'AssemblyVersion\>(.*)\<\/AssemblyVersion' | ForEach-Object { $_.Matches.Groups[1].Value }"
|
||||
for /f "usebackq delims=" %%i in (`powershell -NoLogo -NoProfile -Command "%script%"`) do set version=%%i
|
||||
echo current version is %version%
|
||||
if "%b%"=="" ( set "b=%version%" )
|
||||
|
||||
set "tmpfolder=%~dp0dist\BetterGI"
|
||||
set "archiveFile=BetterGI_v%b%.7z"
|
||||
|
||||
@@ -6,16 +6,11 @@ mkdir dist\BetterGI
|
||||
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath`) do set "path=%path%;%%i\MSBuild\Current\Bin;%%i\Common7\IDE"
|
||||
|
||||
@echo [prepare version]
|
||||
cd /d ..\BetterGenshinImpact\Core\Config
|
||||
set "script=Get-Content 'Global.cs' ^| Select-String -Pattern 'Version.*\"(.*)\"' ^| ForEach-Object { $_.Matches.Groups[1].Value }"
|
||||
|
||||
for /f "usebackq delims=" %%i in (`powershell -NoLogo -NoProfile -Command ^"%script%^"`) do set version=%%i
|
||||
|
||||
echo currnet version is %version%
|
||||
|
||||
if "%b%"=="" (
|
||||
set "b=%version%"
|
||||
)
|
||||
cd /d ..\BetterGenshinImpact
|
||||
set "script=Get-Content 'BetterGenshinImpact.csproj' | Select-String -Pattern 'AssemblyVersion\>(.*)\<\/AssemblyVersion' | ForEach-Object { $_.Matches.Groups[1].Value }"
|
||||
for /f "usebackq delims=" %%i in (`powershell -NoLogo -NoProfile -Command "%script%"`) do set version=%%i
|
||||
echo current version is %version%
|
||||
if "%b%"=="" ( set "b=%version%" )
|
||||
|
||||
set "tmpfolder=%~dp0dist\BetterGI"
|
||||
set "archiveFile=BetterGI_v%b%.7z"
|
||||
|
||||
Reference in New Issue
Block a user