Merge branch 'dev' of http://8.153.108.90:3000/YD/Wpf_AiSportsMicrospace into dev
This commit is contained in:
commit
64bdaa3e05
BIN
Wpf_AiSportsMicrospace/Resources/Img/提示图.png
Normal file
BIN
Wpf_AiSportsMicrospace/Resources/Img/提示图.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 641 KiB |
@ -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)
|
||||
|
||||
@ -67,6 +67,56 @@ 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)
|
||||
{
|
||||
@ -150,7 +200,6 @@ namespace Wpf_AiSportsMicrospace.Views
|
||||
// 可在这里绑定抽帧事件
|
||||
_mainWin.HumanFrameUpdated += OnHumanFrameUpdated;
|
||||
}
|
||||
|
||||
private void OnHumanFrameUpdated(object sender, List<Human> humans)
|
||||
{
|
||||
try
|
||||
|
||||
@ -57,6 +57,7 @@
|
||||
<None Remove="Resources\Img\test_img\test_jump.png" />
|
||||
<None Remove="Resources\Img\test_img\test_rope.png" />
|
||||
<None Remove="Resources\Img\test_img\test_situp.png" />
|
||||
<None Remove="Resources\Img\提示图.png" />
|
||||
<None Remove="Resources\Music\comeon.mp3" />
|
||||
<None Remove="Resources\Music\countdown_3.mp3" />
|
||||
<None Remove="Resources\Music\homeprojectselected.mp3" />
|
||||
@ -249,6 +250,9 @@
|
||||
<Resource Include="Resources\Img\test_img\test_situp.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Img\提示图.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Resources\Music\comeon.mp3">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user