Merge remote-tracking branch 'origin/main'

This commit is contained in:
辉鸭蛋
2026-01-14 00:39:11 +08:00
3 changed files with 26 additions and 40 deletions

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyName>BetterGI</AssemblyName>
<Version>0.54.2-alpha.3</Version>
<Version>0.54.2-alpha.4</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>

View File

@@ -168,40 +168,17 @@ public class ScriptRepoUpdater : Singleton<ScriptRepoUpdater>
return;
}
// 获取远程分支信息并拉取最新数据
var remote = repo.Network.Remotes["origin"];
// 直接获取远程分支的 Commit SHA
var remoteReferences = repo.Network.ListReferences(repoUrl, CreateCredentialsHandler());
var remoteBranch = remoteReferences.FirstOrDefault(r => r.CanonicalName == "refs/heads/release");
var fetchOptions = new FetchOptions
{
ProxyOptions = { ProxyType = ProxyType.None },
Depth = 1, // 浅拉取,只获取最新的提交
CredentialsProvider = CreateCredentialsHandler(), // 添加凭据处理器
OnTransferProgress = progress =>
{
onCheckoutProgress?.Invoke($"拉取对象 {progress.ReceivedObjects}/{progress.TotalObjects}", progress.ReceivedObjects, progress.TotalObjects);
return true;
}
};
// 拉取到远程追踪分支
string refSpec = $"+refs/heads/release:refs/remotes/origin/release";
Commands.Fetch(repo, remote.Name, new[] { refSpec }, fetchOptions, "拉取最新更新");
// 获取本地和远程commit
var localBranch = repo.Branches["release"];
if (localBranch == null)
{
throw new Exception("未找到本地release分支");
}
var remoteBranch = repo.Branches["origin/release"];
if (remoteBranch == null)
{
throw new Exception("未找到远程release分支");
}
var currentCommitSha = localBranch.Tip?.Sha;
var remoteCommitSha = remoteBranch.Tip.Sha;
var remoteCommitSha = remoteBranch.TargetIdentifier;
var currentCommitSha = repo.Branches["release"]?.Tip?.Sha;
// 比较本地和远程commit
if (currentCommitSha == remoteCommitSha)

View File

@@ -128,28 +128,37 @@ public class Avatar
}
Logger.LogInformation("游泳检测:尝试回到战斗地点");
var pathExecutor = new PathExecutor(ct);
var cts = new CancellationTokenSource();
var pathExecutor = new PathExecutor(cts.Token);
try
{
pathExecutor.FaceTo(AutoFightTask.FightWaypoint).Wait(2000, ct);
AutoFightTask.FightWaypoint.MoveMode = MoveModeEnum.Fly.Code;//改为跳飞
pathExecutor.FaceTo(AutoFightTask.FightWaypoint).Wait(2000,cts.Token);
AutoFightTask.FightWaypoint.MoveMode = MoveModeEnum.Fly.Code; // 改为跳飞
Simulation.SendInput.Mouse.RightButtonDown();
pathExecutor.MoveTo(AutoFightTask.FightWaypoint).Wait(15000, ct);
AutoFightTask.FightWaypoint = null;//执行后清空,即每次战斗只执行一次,第二次直接去七天神像
pathExecutor.MoveTo(AutoFightTask.FightWaypoint).Wait(15000,cts.Token);
cts.Cancel();
AutoFightTask.FightWaypoint = null;
Simulation.SendInput.Mouse.RightButtonUp();
}
catch (TaskCanceledException)
{
Logger.LogError("游泳检测:回到战斗地点任务被取消");
}
catch (Exception ex)
{
Logger.LogWarning(ex, "游泳检测:回到战斗地点异常");
Logger.LogError(ex, "游泳检测:回到战斗地点异常");
}
finally
{
Simulation.ReleaseAllKey();
}
Simulation.ReleaseAllKey();
using var ra2 = CaptureToRectArea();
if (!SwimmingConfirm(ra2))
using var bitmap2 = CaptureToRectArea();
if (!SwimmingConfirm(bitmap2))
{
Logger.LogInformation("游泳检测:游泳脱困成功");
return;
return;
}
Logger.LogWarning("游泳检测:回到战斗地点失败");