mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-21 09:45:48 +08:00
opt track
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoTrackPath.Model;
|
||||
@@ -20,6 +21,19 @@ public class GiPath
|
||||
return;
|
||||
}
|
||||
|
||||
WayPointList.Add(GiPathPoint.BuildFrom(matchRect, WayPointList.Count));
|
||||
// 离上个点距离小于 10 的矩形不加入
|
||||
var giPathPoint = GiPathPoint.BuildFrom(matchRect, WayPointList.Count);
|
||||
if (WayPointList.Count > 0)
|
||||
{
|
||||
var lastPoint = WayPointList[^1];
|
||||
var distance = MathHelper.Distance(giPathPoint.Pt, lastPoint.Pt);
|
||||
if (distance < 10)
|
||||
{
|
||||
Debug.WriteLine($"距离上个点太近: {distance},舍弃");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
WayPointList.Add(giPathPoint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,15 +20,7 @@ public class GiPathPoint
|
||||
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 下个点位相对本点位的角度
|
||||
/// </summary>
|
||||
public int NextAngle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 下个点位相对本点位的距离
|
||||
/// </summary>
|
||||
public int NextDistance { get; set; }
|
||||
public string Type { get; set; } = GiPathPointType.Normal.ToString();
|
||||
|
||||
public static GiPathPoint BuildFrom(Rect matchRect, int index)
|
||||
{
|
||||
@@ -41,4 +33,23 @@ public class GiPathPoint
|
||||
Time = DateTime.Now
|
||||
};
|
||||
}
|
||||
|
||||
public static bool IsKeyPoint(GiPathPoint giPathPoint)
|
||||
{
|
||||
if (giPathPoint.Type == GiPathPointType.KeyPoint.ToString()
|
||||
|| giPathPoint.Type == GiPathPointType.Fighting.ToString()
|
||||
|| giPathPoint.Type == GiPathPointType.Collection.ToString())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public enum GiPathPointType
|
||||
{
|
||||
Normal, // 普通点
|
||||
KeyPoint, // 关键点
|
||||
Fighting, // 战斗点
|
||||
Collection, // 采集点
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user