This commit is contained in:
tanglong 2026-03-13 16:38:18 +08:00
commit bd2b141bdf
2 changed files with 28 additions and 27 deletions

View File

@ -209,7 +209,7 @@ namespace Views.JumpLong
// }; // };
// TipBox.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); // TipBox.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation);
// }); // });;
//}); //});
} }

View File

@ -2,6 +2,7 @@
using Common; using Common;
using Dto; using Dto;
using Emgu.CV.Flann; using Emgu.CV.Flann;
using Emgu.CV.Structure;
using Enum; using Enum;
using HandyControl.Controls; using HandyControl.Controls;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@ -66,7 +67,7 @@ namespace Wpf_AiSportsMicrospace.Views
private readonly object _updateLock = new object(); private readonly object _updateLock = new object();
private readonly Dictionary<int, (string lastNumber, DateTime lastChangeTime, string currentState)> _jumpStatus = new Dictionary<int, (string, DateTime, string)>(); private readonly Dictionary<int, (string lastNumber, DateTime lastChangeTime, string currentState)> _jumpStatus = new Dictionary<int, (string, DateTime, string)>();
private GroupJumpRopeContext _groupJumpRopeContext; private GroupJumpRopeContext _groupJumpRopeContext;
Image tipImage;
public GroupJumpRope() public GroupJumpRope()
{ {
InitializeComponent(); InitializeComponent();
@ -84,11 +85,9 @@ namespace Wpf_AiSportsMicrospace.Views
using var scope = App.AppHost.Services.CreateScope(); using var scope = App.AppHost.Services.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>(); var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
// 获取配置 var points = new[] { cfg.Point1, cfg.Point2, cfg.Point3,
var pointCount = await db.BasicConfig cfg.Point4, cfg.Point5, cfg.Point6,
.Where(x => x.Code == AppSettings.Code) cfg.Point7, cfg.Point8, cfg.Point9, cfg.Point10 };
.Select(x => x.HomeWidth)
.FirstOrDefaultAsync();
var cfg = await db.GroupPoints.FirstOrDefaultAsync(x => x.Code == AppSettings.Code); var cfg = await db.GroupPoints.FirstOrDefaultAsync(x => x.Code == AppSettings.Code);
@ -138,13 +137,14 @@ namespace Wpf_AiSportsMicrospace.Views
} }
private void ShowCenterTip(string imagePath, TimeSpan duration) private void ShowCenterTip(string imagePath, TimeSpan duration)
{ {
var tipImage = new Image tipImage = new Image
{ {
Source = new BitmapImage(new Uri(imagePath, UriKind.Absolute)), Source = new BitmapImage(new Uri(imagePath, UriKind.Absolute)),
HorizontalAlignment = HorizontalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,
Opacity = 0, Opacity = 0,
Margin = new Thickness(0, -100, 0, 0), Margin = new Thickness(0, -100, 0, 0),
Name= "TipImage"
}; };
// 增加图片的大小,调整比例 // 增加图片的大小,调整比例
@ -164,26 +164,26 @@ namespace Wpf_AiSportsMicrospace.Views
tipImage.BeginAnimation(UIElement.OpacityProperty, fadeInAnimation); tipImage.BeginAnimation(UIElement.OpacityProperty, fadeInAnimation);
// 定时移除,并且渐变消失 // 定时移除,并且渐变消失
Task.Delay(duration).ContinueWith(_ => //Task.Delay(duration).ContinueWith(_ =>
{ //{
Dispatcher.Invoke(() => // Dispatcher.Invoke(() =>
{ // {
// 渐变消失动画 // // 渐变消失动画
var fadeOutAnimation = new DoubleAnimation // var fadeOutAnimation = new DoubleAnimation
{ // {
From = 1, // From = 1,
To = 0, // To = 0,
Duration = TimeSpan.FromSeconds(1.5) // Duration = TimeSpan.FromSeconds(1.5)
}; // };
tipImage.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); // tipImage.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation);
// 完成后移除图片 // // 完成后移除图片
fadeOutAnimation.Completed += (s, e) => // fadeOutAnimation.Completed += (s, e) =>
{ // {
userBox.Children.Remove(tipImage); // userBox.Children.Remove(tipImage);
}; // };
}); // });
}); //});
} }
private void MediaPlayer_MediaEnded(object sender, EventArgs e) private void MediaPlayer_MediaEnded(object sender, EventArgs e)
@ -239,6 +239,7 @@ namespace Wpf_AiSportsMicrospace.Views
private async void StartCountdown(int start = 3) private async void StartCountdown(int start = 3)
{ {
_mainWin.ShowCountDownAnimation(); _mainWin.ShowCountDownAnimation();
//_currentCountdown = start;
Utils.PlayBackgroundMusic("countdown_3.mp3", false); Utils.PlayBackgroundMusic("countdown_3.mp3", false);