mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-21 09:45:48 +08:00
在 `TpTask.cs` 文件中,添加了 `using BetterGenshinImpact.GameTask.Common.Exceptions;` 引用,并在 `TpTask` 类中添加了对 `TpPointNotActivate` 异常的处理逻辑,当传送点未激活或不存在时,按下 ESC 键返回大地图界面,并抛出异常。同时在 `ClickTpPoint` 方法中,修改了判断逻辑,增加了对传送点未激活或不存在的异常处理。 在 `MapAssets.cs`、`NewRetry.cs`、`TaskControl.cs` 文件中,将 `Exception` 修改为 `System.Exception`。 在 `NormalEndException.cs` 和 `RetryException.cs` 文件中,删除了旧的异常类定义,并重新添加了新的异常类定义。 在 `TpPointNotActivate.cs` 文件中,添加了新的异常类 `TpPointNotActivate`。
42 lines
1.5 KiB
C#
42 lines
1.5 KiB
C#
using BetterGenshinImpact.Core.Config;
|
|
using BetterGenshinImpact.GameTask.AutoTrackPath.Model;
|
|
using BetterGenshinImpact.GameTask.Model;
|
|
using BetterGenshinImpact.Service;
|
|
using OpenCvSharp;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Text.Json;
|
|
|
|
namespace BetterGenshinImpact.GameTask.Common.Element.Assets;
|
|
|
|
public class MapAssets : BaseAssets<MapAssets>
|
|
{
|
|
public Lazy<Mat> MainMap2048BlockMat { get; } = new(() => new Mat(@"E:\HuiTask\更好的原神\地图匹配\有用的素材\5.0\mainMap2048Block.png", ImreadModes.Grayscale));
|
|
|
|
public Lazy<Mat> MainMap256BlockMat { get; } = new(() => new Mat(Global.Absolute(@"Assets\Map\mainMap256Block.png"), ImreadModes.Grayscale));
|
|
|
|
// 2048 区块下,存在传送点的最大面积,识别结果比这个大的话,需要点击放大
|
|
|
|
// 传送点信息
|
|
|
|
public List<GiWorldPosition> TpPositions;
|
|
|
|
// 每个地区点击后处于的中心位置
|
|
public readonly Dictionary<string, double[]> CountryPositions = new()
|
|
{
|
|
{ "蒙德", [-876, 2278] },
|
|
{ "璃月", [270, -666] },
|
|
{ "稻妻", [-4400, -3050] },
|
|
{ "须弥", [2877, -374] },
|
|
{ "枫丹", [4515, 3631] },
|
|
{ "纳塔", [8973.5, -1879.1] },
|
|
};
|
|
|
|
public MapAssets()
|
|
{
|
|
var json = File.ReadAllText(Global.Absolute(@"GameTask\AutoTrackPath\Assets\tp.json"));
|
|
TpPositions = JsonSerializer.Deserialize<List<GiWorldPosition>>(json, ConfigService.JsonOptions) ?? throw new System.Exception("tp.json deserialize failed");
|
|
}
|
|
}
|