diff --git a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowItem.cs b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowItem.cs index 5d5cf75..ad09b60 100644 --- a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowItem.cs +++ b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowItem.cs @@ -13,7 +13,7 @@ namespace Wpf_AiSportsMicrospace.MyUserControl { public Uri ImageUri { get; set; } - private double _progress; + private double _progress = 0; private String _progressColor1 = "#e73d42"; public String ProgressColor1 @@ -55,7 +55,7 @@ namespace Wpf_AiSportsMicrospace.MyUserControl } } - private bool _isSelected; + private bool _isSelected = false; public bool IsSelected { get => _isSelected; diff --git a/Wpf_AiSportsMicrospace/Resources/Music/jumphand.mp3 b/Wpf_AiSportsMicrospace/Resources/Music/jumphand.mp3 new file mode 100644 index 0000000..a2bdc65 Binary files /dev/null and b/Wpf_AiSportsMicrospace/Resources/Music/jumphand.mp3 differ diff --git a/Wpf_AiSportsMicrospace/Resources/app.ico b/Wpf_AiSportsMicrospace/Resources/app.ico index 253e588..c1c7523 100644 Binary files a/Wpf_AiSportsMicrospace/Resources/app.ico and b/Wpf_AiSportsMicrospace/Resources/app.ico differ diff --git a/Wpf_AiSportsMicrospace/Views/Home.xaml b/Wpf_AiSportsMicrospace/Views/Home.xaml index a240baf..7678e57 100644 --- a/Wpf_AiSportsMicrospace/Views/Home.xaml +++ b/Wpf_AiSportsMicrospace/Views/Home.xaml @@ -51,8 +51,9 @@ HorizontalAlignment="right" VerticalAlignment="Top" Width="330" - Height="400" + Height="400" Margin="0,100,0,0" + MouseDown="GoPro" /> - + diff --git a/Wpf_AiSportsMicrospace/Views/Home.xaml.cs b/Wpf_AiSportsMicrospace/Views/Home.xaml.cs index d3700fa..a2bb600 100644 --- a/Wpf_AiSportsMicrospace/Views/Home.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/Home.xaml.cs @@ -50,7 +50,7 @@ namespace Wpf_AiSportsMicrospace { ImageUri = GetResourceUri("test_img/test_rope.png"), ProgressColor1 = "#215bc7", - ProgressColor2 = "#fc640e" + ProgressColor2 = "#fc640e", }); coverFlow.Images.Add(new CoverFlowItem { @@ -133,11 +133,20 @@ namespace Wpf_AiSportsMicrospace } //测试点击 - private void GoNew(object sender, MouseButtonEventArgs e) + private async void GoNew(object sender, MouseButtonEventArgs e) { RouterGoNew(); } + private async void GoPro(object sender, MouseButtonEventArgs e) + { + coverFlow.StartSelectedProgress(); + Debug.WriteLine("点击进度条"); + //await Task.Delay(3000); + //RouterGoNew(); + + } + //跳转二级页面 private void RouterGoNew() { diff --git a/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs index 1d160b5..890a006 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs @@ -3,6 +3,7 @@ using AiSportsMicrospaceDB.Entities; using Common; using Dto; using Enum; +using HandyControl.Controls; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Concurrent; @@ -74,7 +75,7 @@ namespace Views.JumpLong private async void UserControl_Loaded(object sender, RoutedEventArgs e) { // 播放音乐 - PlayMusic("raisehand.mp3"); + PlayMusic("jumphand.mp3"); var app = (App)Application.Current; using var scope = App.AppHost.Services.CreateScope(); @@ -121,6 +122,7 @@ namespace Views.JumpLong int rightWaving = DetectRightHandRaise(humans); if (rightWaving >= 3 && _sportType == 0) //举手完成 开始跳远检测 { + TipBox.Opacity = 0; _sportType = 1; StartSport(); } @@ -193,22 +195,22 @@ namespace Views.JumpLong }; TipBox.BeginAnimation(UIElement.OpacityProperty, fadeInAnimation); - // 定时移除,并且渐变消失 - Task.Delay(duration).ContinueWith(_ => - { - Dispatcher.Invoke(() => - { - // 渐变消失动画 - var fadeOutAnimation = new DoubleAnimation - { - From = 1, - To = 0, - Duration = TimeSpan.FromSeconds(1.5) - }; - TipBox.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); + //// 定时移除,并且渐变消失 + //Task.Delay(duration).ContinueWith(_ => + //{ + // Dispatcher.Invoke(() => + // { + // // 渐变消失动画 + // var fadeOutAnimation = new DoubleAnimation + // { + // From = 1, + // To = 0, + // Duration = TimeSpan.FromSeconds(1.5) + // }; + // TipBox.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); - }); - }); + // }); + //}); } private void MediaPlayer_MediaEnded(object sender, EventArgs e) diff --git a/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs index aba1054..20784b7 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs @@ -50,7 +50,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope private GameState _currentGameState = GameState.NotStarted; private readonly HttpClient _httpClient; SportOperate sportOperate = new SportOperate(); - + Image tipImage; // 容忍时间(节拍误差) public double _beatTolerance = 0.24; // ±150ms // 滚动显示的节拍点集合 @@ -81,7 +81,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope var cfg = await db.GroupPoints.FirstOrDefaultAsync(x => x.Code == AppSettings.Code); //var pointlist = JsonSerializer.Deserialize>(cfg!.PointsJson); - List<(double XNorm, double YNorm)> pointlist = [(cfg.ControlPoint.X, cfg.ControlPoint.Y), (cfg.Point5.X, cfg.Point5.Y)]; + List<(double XNorm, double YNorm)> pointlist = [(cfg.ControlPoint.X, cfg.ControlPoint.Y), (cfg.Point10.X, cfg.Point10.Y)]; _musicJumpRopeContext.UpdateCirclePositions(pointlist); _mainWin.HumanFrameUpdated += OnHumanFrameUpdated; @@ -115,7 +115,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope } private void ShowCenterTip(string imagePath, TimeSpan duration) { - var tipImage = new Image + tipImage = new Image { Source = new BitmapImage(new Uri(imagePath, UriKind.Absolute)), HorizontalAlignment = HorizontalAlignment.Center, @@ -141,26 +141,26 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope tipImage.BeginAnimation(UIElement.OpacityProperty, fadeInAnimation); // 定时移除,并且渐变消失 - Task.Delay(duration).ContinueWith(_ => - { - Dispatcher.Invoke(() => - { - // 渐变消失动画 - var fadeOutAnimation = new DoubleAnimation - { - From = 1, - To = 0, - Duration = TimeSpan.FromSeconds(1.5) - }; - tipImage.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); + //Task.Delay(duration).ContinueWith(_ => + //{ + // Dispatcher.Invoke(() => + // { + // // 渐变消失动画 + // var fadeOutAnimation = new DoubleAnimation + // { + // From = 1, + // To = 0, + // Duration = TimeSpan.FromSeconds(1.5) + // }; + // tipImage.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); - // 完成后移除图片 - fadeOutAnimation.Completed += (s, e) => - { - userBox.Children.Remove(tipImage); - }; - }); - }); + // // 完成后移除图片 + // fadeOutAnimation.Completed += (s, e) => + // { + // userBox.Children.Remove(tipImage); + // }; + // }); + //}); } private void MediaPlayer_MediaEnded(object sender, EventArgs e) { @@ -235,6 +235,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope private DateTime _lastUpdateTime = DateTime.Now; private async void StartCountdown(int start = 4) { + tipImage.Visibility = Visibility.Hidden; _mainWin.ShowCountDownAnimation(); _isCountdownStarted = true; _currentCountdown = start; diff --git a/Wpf_AiSportsMicrospace/Views/Setting/MultiJumpRope.xaml b/Wpf_AiSportsMicrospace/Views/Setting/MultiJumpRope.xaml index d769e32..d47bb41 100644 --- a/Wpf_AiSportsMicrospace/Views/Setting/MultiJumpRope.xaml +++ b/Wpf_AiSportsMicrospace/Views/Setting/MultiJumpRope.xaml @@ -44,7 +44,7 @@ --> - + @@ -53,21 +53,21 @@ - + - + - +