Skip to content

Commit b731a87

Browse files
更正Dispatcher.RunTask内CountInventoryItem的入参名称 (#2158)
1 parent 6550340 commit b731a87

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

BetterGenshinImpact/Core/Script/Dependence/Dispatcher.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ public async Task RunTask(SoloTask soloTask, CancellationTokenSource customCts)
260260
throw new NullReferenceException($"{nameof(soloTask.Config)}为空");
261261
}
262262
GridScreenName gridScreenName = ScriptObjectConverter.GetValue<GridScreenName?>((ScriptObject)soloTask.Config, "gridScreenName", null) ?? throw new Exception("gridScreenName为空或错误");
263-
string foodName = ScriptObjectConverter.GetValue<string?>((ScriptObject)soloTask.Config, "foodName", null) ?? throw new Exception("foodName为空");
264-
return await new CountInventoryItem(gridScreenName, foodName).Start(cancellationToken);
263+
string itemName = ScriptObjectConverter.GetValue<string?>((ScriptObject)soloTask.Config, "itemName", null) ?? throw new Exception("itemName为空");
264+
return await new CountInventoryItem(gridScreenName, itemName).Start(cancellationToken);
265265
}
266266
default:
267267
throw new ArgumentException($"未知的任务名称: {soloTask.Name}", nameof(soloTask.Name));

BetterGenshinImpact/GameTask/Common/Job/CountInventoryItem.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ internal class CountInventoryItem : ISoloTask<int>
2424
private readonly InputSimulator input = Simulation.SendInput;
2525
private CancellationToken ct;
2626
private readonly GridScreenName gridScreenName;
27-
private readonly string foodName;
27+
private readonly string itemName;
2828

29-
public CountInventoryItem(GridScreenName gridScreenName, string foodName)
29+
public CountInventoryItem(GridScreenName gridScreenName, string itemName)
3030
{
3131
this.gridScreenName = gridScreenName;
32-
this.foodName = foodName;
32+
this.itemName = itemName;
3333
}
3434

3535
public async Task<int> Start(CancellationToken ct)
3636
{
3737
this.ct = ct;
3838

39-
logger.LogInformation("打开背包并在{grid}寻找{name}……", this.gridScreenName, this.foodName);
39+
logger.LogInformation("打开背包并在{grid}寻找{name}……", this.gridScreenName, this.itemName);
4040
await new ReturnMainUiTask().Start(ct);
4141
await AutoArtifactSalvageTask.OpenInventory(this.gridScreenName, input, logger, this.ct);
4242

@@ -50,7 +50,7 @@ public async Task<int> Start(CancellationToken ct)
5050
using Mat icon = itemRegion.SrcMat.GetGridIcon();
5151
var result = GridIconsAccuracyTestTask.Infer(icon, session, prototypes);
5252
string predName = result.Item1;
53-
if (predName == this.foodName)
53+
if (predName == this.itemName)
5454
{
5555
string numStr = itemRegion.SrcMat.GetGridItemIconText(OcrFactory.Paddle);
5656
if (int.TryParse(numStr, out int num))
@@ -69,7 +69,7 @@ public async Task<int> Start(CancellationToken ct)
6969
if (count == null)
7070
{
7171
count = -1;
72-
logger.LogInformation("没有找到{name}", this.foodName);
72+
logger.LogInformation("没有找到{name}", this.itemName);
7373
}
7474
await new ReturnMainUiTask().Start(ct);
7575

0 commit comments

Comments
 (0)