This commit is contained in:
tanglong 2025-10-14 19:47:25 +08:00
parent 68b5ad8c1e
commit 20c62d9927

View File

@ -350,10 +350,9 @@ namespace Wpf_AiSportsMicrospace.Views
private void UpdateCircleCounts(List<Human> humans) private void UpdateCircleCounts(List<Human> humans)
{ {
lock (_updateLock)
{
double radiusNormX = 0.07; double radiusNormX = 0.07;
double radiusNormY = 0.07; double radiusNormY = 0.14;
for (int i = 0; i < circlePositions.Count; i++) for (int i = 0; i < circlePositions.Count; i++)
{ {
@ -390,14 +389,16 @@ namespace Wpf_AiSportsMicrospace.Views
// 根据是否有人和跳绳数字判断状态 // 根据是否有人和跳绳数字判断状态
bool hasHuman = humanInCircle != null; bool hasHuman = humanInCircle != null;
lock (_updateLock)
{
userList[i].ImageState = GetJumpState(i, hasHuman); userList[i].ImageState = GetJumpState(i, hasHuman);
}
// 推送计数 // 推送计数
if (hasHuman) if (hasHuman)
sports[i].Pushing(humanInCircle); sports[i].Pushing(humanInCircle);
} }
} }
}
private string GetJumpState(int circleIndex, bool humanInCircle) private string GetJumpState(int circleIndex, bool humanInCircle)
{ {
@ -426,7 +427,7 @@ namespace Wpf_AiSportsMicrospace.Views
// 数字未变化,判断是否超过 2 秒 // 数字未变化,判断是否超过 2 秒
double elapsed = (DateTime.Now - lastChangeTime).TotalSeconds; double elapsed = (DateTime.Now - lastChangeTime).TotalSeconds;
if (elapsed >= 3) if (elapsed >= 2)
{ {
// 超过 2 秒未变化 → 停止 // 超过 2 秒未变化 → 停止
_jumpStatus[circleIndex] = (currentNumber, lastChangeTime, "1"); _jumpStatus[circleIndex] = (currentNumber, lastChangeTime, "1");