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