diff --git a/BetterGenshinImpact/BetterGenshinImpact.csproj b/BetterGenshinImpact/BetterGenshinImpact.csproj index dd2507d0..fd54e030 100644 --- a/BetterGenshinImpact/BetterGenshinImpact.csproj +++ b/BetterGenshinImpact/BetterGenshinImpact.csproj @@ -10,7 +10,7 @@ true Assets\Images\logo.ico BetterGI - 0.39.0 + 0.39.1 x64 embedded diff --git a/BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs b/BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs index 1575f1fd..75065796 100644 --- a/BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs +++ b/BetterGenshinImpact/GameTask/AutoDomain/AutoDomainTask.cs @@ -117,13 +117,13 @@ public class AutoDomainTask : ISoloTask var combatScenes = new CombatScenes().InitializeTeam(CaptureToRectArea()); // 前置进入秘境 - EnterDomain(); + await EnterDomain(); for (var i = 0; i < _taskParam.DomainRoundNum; i++) { // 0. 关闭秘境提示 Logger.LogDebug("0. 关闭秘境提示"); - CloseDomainTip(); + await CloseDomainTip(); // 队伍没初始化成功则重试 RetryTeamInit(combatScenes); @@ -249,7 +249,7 @@ public class AutoDomainTask : ISoloTask Thread.Sleep(3000); Simulation.SendInput.Keyboard.KeyUp(VK.VK_W); } - + await Delay(3000, _ct); // 站稳 } else @@ -277,7 +277,7 @@ public class AutoDomainTask : ISoloTask return true; } - private void EnterDomain() + private async Task EnterDomain() { var fightAssets = AutoFightContext.Instance.FightAssets; @@ -288,7 +288,7 @@ public class AutoDomainTask : ISoloTask Simulation.SendInput.Keyboard.KeyPress(VK.VK_F); Logger.LogInformation("自动秘境:{Text}", "进入秘境"); // 秘境开门动画 5s - Sleep(5000, _ct); + await Delay(5000, _ct); } int retryTimes = 0, clickCount = 0; @@ -302,14 +302,14 @@ public class AutoDomainTask : ISoloTask clickCount++; } - Sleep(1500, _ct); + await Delay(1500, _ct); } // 载入动画 - Sleep(3000, _ct); + await Delay(3000, _ct); } - private void CloseDomainTip() + private async Task CloseDomainTip() { // 2min的载入时间总够了吧 var retryTimes = 0; @@ -319,16 +319,16 @@ public class AutoDomainTask : ISoloTask using var cactRectArea = CaptureToRectArea().Find(AutoFightContext.Instance.FightAssets.ClickAnyCloseTipRa); if (!cactRectArea.IsEmpty()) { - Sleep(1000, _ct); + await Delay(1000, _ct); cactRectArea.Click(); break; } // todo 添加小地图角标位置检测 防止有人手点了 - Sleep(1000, _ct); + await Delay(1000, _ct); } - Sleep(1500, _ct); + await Delay(1500, _ct); } private List FindCombatScriptAndSwitchAvatar(CombatScenes combatScenes) diff --git a/BetterGenshinImpact/GameTask/AutoMusicGame/AutoAlbumTask.cs b/BetterGenshinImpact/GameTask/AutoMusicGame/AutoAlbumTask.cs index 9d309217..d025dde7 100644 --- a/BetterGenshinImpact/GameTask/AutoMusicGame/AutoAlbumTask.cs +++ b/BetterGenshinImpact/GameTask/AutoMusicGame/AutoAlbumTask.cs @@ -34,25 +34,27 @@ public class AutoAlbumTask(AutoMusicGameParam taskParam) : ISoloTask public async Task StartOneAlbum(CancellationToken ct) { + using var iconRa = CaptureToRectArea().Find(AutoMusicAssets.Instance.UiLeftTopAlbumIcon); + if (!iconRa.IsExist()) + { + throw new Exception("当前未处于专辑界面,请在专辑界面运行本任务"); + } + // 12个音乐 for (int i = 0; i < 13; i++) { - using var iconRa = CaptureToRectArea().Find(AutoMusicAssets.Instance.UiLeftTopAlbumIcon); - if (!iconRa.IsExist()) - { - throw new Exception("当前未处于专辑界面,请在专辑界面运行本任务"); - } + using var doneRa = CaptureToRectArea().Find(AutoMusicAssets.Instance.AlbumMusicComplate); if (doneRa.IsExist()) { - Logger.LogInformation("当前音乐{Num}所有奖励已领取,切换下一首", i + 1); + Logger.LogInformation("当前乐曲{Num}所有奖励已领取,切换下一首", i + 1); GameCaptureRegion.GameRegion1080PPosClick(310, 220); await Delay(800, ct); continue; } - Logger.LogInformation("当前音乐{Num}存在未领取奖励,前往演奏", i + 1); + Logger.LogInformation("当前乐曲{Num}存在未领取奖励,前往演奏", i + 1); Bv.ClickWhiteConfirmButton(CaptureToRectArea()); await Delay(800, ct); // 点击传说 @@ -86,10 +88,15 @@ public class AutoAlbumTask(AutoMusicGameParam taskParam) : ISoloTask // 等待任意一个任务完成 await Task.WhenAny(checkTask, musicTask); await cts.CancelAsync(); - Logger.LogInformation("当前音乐{Num}演奏结束", i + 1); + Logger.LogInformation("当前乐曲{Num}演奏结束", i + 1); await Delay(2000, ct); + + await Bv.WaitUntilFound(AutoMusicAssets.Instance.UiLeftTopAlbumIcon, ct); + Logger.LogInformation("切换下一首"); + GameCaptureRegion.GameRegion1080PPosClick(310, 220); + await Delay(800, ct); } - Logger.LogInformation("当前专辑所有音乐演奏结束"); + Logger.LogInformation("当前专辑所有乐曲演奏结束"); } } \ No newline at end of file