From 4463e4b256bf644e35b782bfbd1ca268fba94a45 Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Wed, 14 Jan 2026 10:35:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BE=E6=89=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/JumpRope/GroupJumpRope.xaml.cs | 2 +- .../Views/JumpRope/MusicJumpRope.xaml.cs | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs index 9d1e7f7..db882b3 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs @@ -207,7 +207,7 @@ namespace Wpf_AiSportsMicrospace.Views } int rightWaving = DetectRightHandRaise(humans); - if (rightWaving >= 3) + if (rightWaving >= 3 && RankingGrid.Visibility != Visibility.Visible) { switch (rightWaving) { diff --git a/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs index 5285dc9..927145c 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs @@ -90,7 +90,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope var cfg = await db.SixGroupPoints.FirstOrDefaultAsync(x => x.Code == AppSettings.Code); //var pointlist = JsonSerializer.Deserialize>(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 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;