diff --git a/Wpf_AiSportsMicrospace/Resources/Img/play_img/music_rope/back.png b/Wpf_AiSportsMicrospace/Resources/Img/play_img/music_rope/back.png new file mode 100644 index 0000000..13169b0 Binary files /dev/null and b/Wpf_AiSportsMicrospace/Resources/Img/play_img/music_rope/back.png differ diff --git a/Wpf_AiSportsMicrospace/Resources/Img/play_img/music_rope/lose.png b/Wpf_AiSportsMicrospace/Resources/Img/play_img/music_rope/lose.png new file mode 100644 index 0000000..91127bd Binary files /dev/null and b/Wpf_AiSportsMicrospace/Resources/Img/play_img/music_rope/lose.png differ diff --git a/Wpf_AiSportsMicrospace/Resources/Img/play_img/music_rope/win.png b/Wpf_AiSportsMicrospace/Resources/Img/play_img/music_rope/win.png new file mode 100644 index 0000000..19dfbb0 Binary files /dev/null and b/Wpf_AiSportsMicrospace/Resources/Img/play_img/music_rope/win.png differ diff --git a/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml b/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml index 6fe8aea..c7056d4 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml +++ b/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml @@ -19,7 +19,7 @@ Margin="0,50,0,0" MouseDown="Image_MouseDown" /> - + @@ -55,7 +55,7 @@ - + - - + + - - - - - --> + + + + + + + + + + + + + + + + + diff --git a/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs index d3365c3..a0db29a 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpRope/MusicJumpRope.xaml.cs @@ -295,12 +295,55 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope { _mainWin.HumanFrameUpdated += OnHumanFrameUpdated; _mainWin.WebcamClient.StartExtract(); - + showRank(); // 更新 UI(排行榜或分数板) // ShowRankingBoard(rankList); + }); } + public void showRank() + { + double left = _musicJumpRopeContext.UserBeatSyncList[0]; + double right = _musicJumpRopeContext.UserBeatSyncList[1]; + score3.Text = (left * 10).ToString(); + score4.Text = (right * 10).ToString(); + if (left < right) + { + 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); + + text1.Text = "LOSE"; + text2.Text = "WIN"; + text1.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7987a2")); + text2.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fdcb50")); + } + else if (right == left) { + text2.Text = "WIN"; + text2.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fdcb50")); + lose1.Visibility = Visibility.Hidden; + lose2.Visibility = Visibility.Hidden; + lose3.Visibility = Visibility.Hidden; + + win3.Visibility = Visibility.Visible; + win4.Visibility = Visibility.Visible; + } + showElement("RankingGrid"); + } + + public void showElement(string name, int time = 600) + { + var Element = FindName(name) as FrameworkElement; + if (Element == null) return; + + Element.Visibility = Visibility.Visible; + var fadeIn = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(time)); + Element.BeginAnimation(UIElement.OpacityProperty, fadeIn); + } + private DateTime? _raiseStartTime; private bool _firstHandTriggered; private int _lastCountdownSecond = 3; diff --git a/Wpf_AiSportsMicrospace/Wpf_AiSportsMicrospace.csproj b/Wpf_AiSportsMicrospace/Wpf_AiSportsMicrospace.csproj index 3048eb9..31928d7 100644 --- a/Wpf_AiSportsMicrospace/Wpf_AiSportsMicrospace.csproj +++ b/Wpf_AiSportsMicrospace/Wpf_AiSportsMicrospace.csproj @@ -50,12 +50,14 @@ + + @@ -115,6 +117,9 @@ Always + + Always + Always @@ -276,6 +281,9 @@ Always + + Always + Always