This commit is contained in:
tanglong 2026-01-14 10:35:42 +08:00
parent e58284fb01
commit 4463e4b256
2 changed files with 9 additions and 7 deletions

View File

@ -207,7 +207,7 @@ namespace Wpf_AiSportsMicrospace.Views
}
int rightWaving = DetectRightHandRaise(humans);
if (rightWaving >= 3)
if (rightWaving >= 3 && RankingGrid.Visibility != Visibility.Visible)
{
switch (rightWaving)
{

View File

@ -90,7 +90,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
var cfg = await db.SixGroupPoints.FirstOrDefaultAsync(x => x.Code == AppSettings.Code);
//var pointlist = JsonSerializer.Deserialize<List<(double, double)>>(cfg!.PointsJson);
List<(double XNorm, double YNorm)> pointlist = [(cfg.Point3.X, cfg.Point3.Y),(cfg.Point5.X, cfg.Point5.Y)];
List<(double XNorm, double YNorm)> pointlist = [(cfg.Point3.X, cfg.Point3.Y), (cfg.Point5.X, cfg.Point5.Y)];
_musicJumpRopeContext.UpdateCirclePositions(pointlist);
}
@ -203,7 +203,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
}
int rightWaving = DetectRightHandRaise(humans);
if (rightWaving >= 3)
if (rightWaving >= 3 && RankingGrid.Visibility != Visibility.Visible)
{
switch (rightWaving)
{
@ -247,7 +247,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
//开始人脸识别=============================================
Action<VideoFrame> handler = null;
handler = async (frame) =>
{
double[] xValues = [.. _musicJumpRopeContext.CirclePositions.Select(p => p.XNorm)];
@ -260,7 +260,8 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
_mainWin.FacialRecognitionEvent -= handler;
name1.Text = studentList[0]?.StudentName ?? "一号玩家";
name2.Text = studentList[1]?.StudentName ?? "二号玩家";
if (studentList.Count > 1 && studentList[0].Photo != "") {
if (studentList.Count > 1 && studentList[0].Photo != "")
{
await LoadImageFromUrlAsync(studentList[0]?.Photo ?? "", avatar1);
}
if (studentList.Count > 2 && studentList[1].Photo != "")
@ -278,7 +279,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
_mainWin.FacialRecognitionEvent += handler;
}
private async Task LoadImageFromUrlAsync(string imageUrl , Image image)
private async Task LoadImageFromUrlAsync(string imageUrl, Image image)
{
try
{
@ -399,7 +400,8 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
text1.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7987a2"));
text2.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fdcb50"));
}
else if (right == left) {
else if (right == left)
{
text2.Text = "WIN";
text2.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fdcb50"));
lose1.Visibility = Visibility.Hidden;