mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-21 09:45:48 +08:00
JS获取当前在小地图上的位置坐标 新增 matchingMethod 的传入
This commit is contained in:
@@ -216,6 +216,11 @@ public class Genshin
|
||||
{
|
||||
return GetPositionFromMap(MapTypes.Teyvat.ToString());
|
||||
}
|
||||
|
||||
public Point2f? GetPositionFromMap(string matchingMethod)
|
||||
{
|
||||
return GetPositionFromMap(nameof(MapTypes.Teyvat), matchingMethod);
|
||||
}
|
||||
|
||||
public float GetCameraOrientation()
|
||||
{
|
||||
@@ -230,14 +235,18 @@ public class Genshin
|
||||
/// <param name="cacheTimeMs">缓存时间,单位毫秒,默认900ms</param>
|
||||
/// <returns>包含X和Y坐标的Point2f结构体</returns>
|
||||
public Point2f? GetPositionFromMap(string mapName, int cacheTimeMs = 900)
|
||||
{
|
||||
var matchingMethod = TaskContext.Instance().Config.PathingConditionConfig.MapMatchingMethod;
|
||||
return GetPositionFromMap(mapName,matchingMethod, cacheTimeMs);
|
||||
}
|
||||
|
||||
public Point2f? GetPositionFromMap(string mapName, string matchingMethod, int cacheTimeMs = 900)
|
||||
{
|
||||
var imageRegion = CaptureToRectArea();
|
||||
if (!Bv.IsInMainUi(imageRegion))
|
||||
{
|
||||
throw new InvalidOperationException("不在主界面,无法识别小地图坐标");
|
||||
}
|
||||
|
||||
var matchingMethod = TaskContext.Instance().Config.PathingConditionConfig.MapMatchingMethod;
|
||||
return MapManager.GetMap(mapName, matchingMethod)
|
||||
.ConvertImageCoordinatesToGenshinMapCoordinates(LazyNavigationInstance.Value
|
||||
.GetPositionStableByCache(imageRegion, mapName, matchingMethod, cacheTimeMs));
|
||||
|
||||
Reference in New Issue
Block a user