diff --git a/Wpf_AiSportsMicrospace/Resources/Img/提示图.png b/Wpf_AiSportsMicrospace/Resources/Img/提示图.png
new file mode 100644
index 0000000..d923f6e
Binary files /dev/null and b/Wpf_AiSportsMicrospace/Resources/Img/提示图.png differ
diff --git a/Wpf_AiSportsMicrospace/Views/CenterHome.xaml.cs b/Wpf_AiSportsMicrospace/Views/CenterHome.xaml.cs
index d24c21e..cb9a057 100644
--- a/Wpf_AiSportsMicrospace/Views/CenterHome.xaml.cs
+++ b/Wpf_AiSportsMicrospace/Views/CenterHome.xaml.cs
@@ -69,8 +69,7 @@ namespace Wpf_AiSportsMicrospace.Views
{
_mainWin.HumanFrameUpdated += OnHumanFrameUpdated;
- Utils.PlayBackgroundMusic("homeprojectselected.mp3", true);
-
+ //Utils.PlayBackgroundMusic("homeprojectselected.mp3", true);
}
private void CenterHome_Unloaded(object sender, RoutedEventArgs e)
diff --git a/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs
index 81ec7ed..c2428dc 100644
--- a/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs
+++ b/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs
@@ -15,6 +15,7 @@ using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
+using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
@@ -64,12 +65,64 @@ namespace Wpf_AiSportsMicrospace.Views
{
_mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
}
+ private void ShowCenterTip(string imagePath, TimeSpan duration)
+ {
+ var tipImage = new Image
+ {
+ Source = new BitmapImage(new Uri(imagePath, UriKind.Absolute)),
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ Opacity = 0
+ };
+
+ // 增加图片的大小,调整比例
+ tipImage.Width = overlayCanvas.ActualWidth * 0.9; // 宽度为 Canvas 宽度的 90%
+ tipImage.Height = overlayCanvas.ActualHeight * 0.6; // 高度为 Canvas 高度的 60%
+
+ // 将图片添加到 Overlay Canvas
+ overlayCanvas.Children.Add(tipImage);
+ Canvas.SetLeft(tipImage, (overlayCanvas.ActualWidth - tipImage.Width) / 2); // 居中
+ Canvas.SetTop(tipImage, (overlayCanvas.ActualHeight - tipImage.Height) / 2); // 居中
+
+ // 渐变出现动画
+ var fadeInAnimation = new DoubleAnimation
+ {
+ From = 0,
+ To = 1,
+ Duration = TimeSpan.FromSeconds(1.5)
+ };
+ 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);
+
+ // 完成后移除图片
+ fadeOutAnimation.Completed += (s, e) =>
+ {
+ overlayCanvas.Children.Remove(tipImage);
+ };
+ });
+ });
+ }
+
private void PlayMusic(string musicFileName)
{
// 获取项目根目录
string projectRoot = System.IO.Path.Combine(AppContext.BaseDirectory, @"..\..\..");
string musicPath = System.IO.Path.Combine(projectRoot, "Resources", "Music", musicFileName);
+ string imgPath = System.IO.Path.Combine(projectRoot, "Resources", "Img", "提示图.png");
if (!File.Exists(musicPath))
{
@@ -79,6 +132,8 @@ namespace Wpf_AiSportsMicrospace.Views
_mediaPlayer.Open(new Uri(musicPath, UriKind.Absolute));
+ ShowCenterTip(imgPath, TimeSpan.FromSeconds(3));
+
// 监听播放完成事件
_mediaPlayer.MediaEnded += MediaPlayer_MediaEnded;
diff --git a/Wpf_AiSportsMicrospace/Wpf_AiSportsMicrospace.csproj b/Wpf_AiSportsMicrospace/Wpf_AiSportsMicrospace.csproj
index fbb23c9..74994c5 100644
--- a/Wpf_AiSportsMicrospace/Wpf_AiSportsMicrospace.csproj
+++ b/Wpf_AiSportsMicrospace/Wpf_AiSportsMicrospace.csproj
@@ -48,6 +48,7 @@
+
@@ -213,6 +214,9 @@
Always
+
+ Always
+
Always