diff --git a/Wpf_AiSportsMicrospace/MyUserControl/PopSilder.xaml b/Wpf_AiSportsMicrospace/MyUserControl/PopSilder.xaml index 6b5d882..b9d36d7 100644 --- a/Wpf_AiSportsMicrospace/MyUserControl/PopSilder.xaml +++ b/Wpf_AiSportsMicrospace/MyUserControl/PopSilder.xaml @@ -9,14 +9,14 @@ > - + - - + + diff --git a/Wpf_AiSportsMicrospace/MyUserControl/PopSilder.xaml.cs b/Wpf_AiSportsMicrospace/MyUserControl/PopSilder.xaml.cs index 80dfd6c..3136615 100644 --- a/Wpf_AiSportsMicrospace/MyUserControl/PopSilder.xaml.cs +++ b/Wpf_AiSportsMicrospace/MyUserControl/PopSilder.xaml.cs @@ -163,14 +163,14 @@ namespace Wpf_AiSportsMicrospace.MyUserControl private void OnTimePointReached(double timePoint) { Console.WriteLine($"触发时间点: {timePoint}"); - if (_isMiss) + if (isMiss) { head_m.Visibility = Visibility.Visible; miss.Visibility = Visibility.Visible; head_g.Visibility = Visibility.Hidden; great.Visibility = Visibility.Hidden; // 200ms 后隐藏 - var hideTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(200) }; + var hideTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(300) }; hideTimer.Start(); hideTimer.Tick += (s, e) => { @@ -185,8 +185,10 @@ namespace Wpf_AiSportsMicrospace.MyUserControl great.Visibility = Visibility.Visible; head_m.Visibility = Visibility.Hidden; miss.Visibility = Visibility.Hidden; + ShowImageWithAnimation(great , 221 , 172); + ShowImageWithAnimation(head_g , 152 , 82); // 200ms 后隐藏 - var hideTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(200) }; + var hideTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(300) }; hideTimer.Start(); hideTimer.Tick += (s, e) => { @@ -197,6 +199,44 @@ namespace Wpf_AiSportsMicrospace.MyUserControl }; } } + + + private void ShowImageWithAnimation(UIElement ui , int width, int height) + { + + + // 透明度动画 + DoubleAnimation opacityAnimation = new DoubleAnimation + { + From = 0, + To = 1, + Duration = TimeSpan.FromSeconds(0.1) + }; + + // 缩放动画 + DoubleAnimation scaleYAnimation = new DoubleAnimation + { + From = height - 12, + To = height + 12, + Duration = TimeSpan.FromSeconds(0.3), + EasingFunction = new ElasticEase { EasingMode = EasingMode.EaseOut } + }; + + DoubleAnimation scaleXAnimation = new DoubleAnimation + { + From = width - 30, + To = width + 20, + Duration = TimeSpan.FromSeconds(0.3), + EasingFunction = new ElasticEase { EasingMode = EasingMode.EaseOut} + }; + + ui.BeginAnimation(Image.OpacityProperty, opacityAnimation); + ui.BeginAnimation(Image.WidthProperty, scaleXAnimation); + ui.BeginAnimation(Image.HeightProperty, scaleYAnimation); + //ui.BeginAnimation(RotateTransform.AngleProperty, rotateAnimation); + } + + } public class TimedEventTrigger diff --git a/Wpf_AiSportsMicrospace/Resources/Img/Album/leigh.gif b/Wpf_AiSportsMicrospace/Resources/Img/Album/leigh.gif new file mode 100644 index 0000000..b6e41b1 Binary files /dev/null and b/Wpf_AiSportsMicrospace/Resources/Img/Album/leigh.gif differ diff --git a/Wpf_AiSportsMicrospace/Resources/Img/Album/leight.gif b/Wpf_AiSportsMicrospace/Resources/Img/Album/leight.gif new file mode 100644 index 0000000..8663dfd Binary files /dev/null and b/Wpf_AiSportsMicrospace/Resources/Img/Album/leight.gif differ diff --git a/Wpf_AiSportsMicrospace/Views/Home.xaml b/Wpf_AiSportsMicrospace/Views/Home.xaml index 548c000..b770e0d 100644 --- a/Wpf_AiSportsMicrospace/Views/Home.xaml +++ b/Wpf_AiSportsMicrospace/Views/Home.xaml @@ -57,12 +57,22 @@ - + + + + diff --git a/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs index 06590de..f808adb 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs @@ -43,7 +43,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope // 容忍时间(节拍误差) - public double _beatTolerance = 0.22; // ±150ms + public double _beatTolerance = 0.24; // ±150ms private int _totalDots = 0; // 滚动显示的节拍点集合 public ObservableCollection BeatDisplayLeft { get; set; } = new(); @@ -326,8 +326,8 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope lose1.Margin = new Thickness(60, 0, 0, 0); lose2.Margin = new Thickness(60, 0, 0, 0); lose3.Margin = new Thickness(60, 0, 0, 0); - win1.Margin = new Thickness(60, -123, 0, 0); - win2.Margin = new Thickness(60, -123, 0, 0); + win1.Margin = new Thickness(980, -123, 0, 0); + win2.Margin = new Thickness(980, -123, 0, 0); text1.Text = "LOSE"; text2.Text = "WIN"; diff --git a/Wpf_AiSportsMicrospace/Views/Main.xaml b/Wpf_AiSportsMicrospace/Views/Main.xaml index b80a7a1..a1ecc16 100644 --- a/Wpf_AiSportsMicrospace/Views/Main.xaml +++ b/Wpf_AiSportsMicrospace/Views/Main.xaml @@ -6,7 +6,7 @@ xmlns:local="clr-namespace:Wpf_AiSportsMicrospace.Views" xmlns:gif="http://wpfanimatedgif.codeplex.com" WindowStyle="None" - mc:Ignorable="d" WindowState="Maximized"> + mc:Ignorable="d" WindowState="Maximized" MouseDoubleClick="Window_MouseDoubleClick"> diff --git a/Wpf_AiSportsMicrospace/Views/Main.xaml.cs b/Wpf_AiSportsMicrospace/Views/Main.xaml.cs index c55d42c..f2cfa02 100644 --- a/Wpf_AiSportsMicrospace/Views/Main.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/Main.xaml.cs @@ -379,6 +379,15 @@ namespace Wpf_AiSportsMicrospace.Views time3.Visibility = Visibility.Hidden; num++; } + + private void Window_MouseDoubleClick(object sender, MouseButtonEventArgs e) + { + // 确认是左键双击 + if (e.ChangedButton == MouseButton.Right) + { + Application.Current.Shutdown(); + } + } } diff --git a/Wpf_AiSportsMicrospace/Wpf_AiSportsMicrospace.csproj b/Wpf_AiSportsMicrospace/Wpf_AiSportsMicrospace.csproj index 4cc25a0..9830e4e 100644 --- a/Wpf_AiSportsMicrospace/Wpf_AiSportsMicrospace.csproj +++ b/Wpf_AiSportsMicrospace/Wpf_AiSportsMicrospace.csproj @@ -27,6 +27,7 @@ + @@ -97,6 +98,9 @@ + + Always + Always