update:bug
This commit is contained in:
commit
fd9ec745b6
@ -56,7 +56,7 @@ namespace Wpf_AiSportsMicrospace.Common
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_webcamClient = WebcamClient.CreateRTSP("172.17.30.64", "admin", "yd708090", 554u);
|
_webcamClient = WebcamClient.CreateRTSP("172.17.30.65", "admin", "yd708090", 554u);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
DisplayMemberPath="Name"
|
DisplayMemberPath="Name"
|
||||||
SelectedValuePath="Key"
|
SelectedValuePath="Key"
|
||||||
SelectionChanged="sportList_SelectionChanged" d:IsHidden="True"/>
|
SelectionChanged="sportList_SelectionChanged" d:IsHidden="True"/>
|
||||||
<TextBox x:Name="host" Margin="0,10,0,0" Text="192.168.3.64"/>
|
<TextBox x:Name="host" Margin="0,10,0,0" Text="172.17.30.65"/>
|
||||||
<TextBox x:Name="userName" Margin="0,10,0,0" Text="admin"/>
|
<TextBox x:Name="userName" Margin="0,10,0,0" Text="admin"/>
|
||||||
<TextBox x:Name="password" Margin="0,10,0,0" Text="yd708090"/>
|
<TextBox x:Name="password" Margin="0,10,0,0" Text="yd708090"/>
|
||||||
<TextBox x:Name="port" Margin="0,10,0,0" Text="554"/>
|
<TextBox x:Name="port" Margin="0,10,0,0" Text="554"/>
|
||||||
|
|||||||
@ -19,11 +19,11 @@
|
|||||||
/>
|
/>
|
||||||
<Grid Height="1080" Width="1920" x:Name="userBox"/>
|
<Grid Height="1080" Width="1920" x:Name="userBox"/>
|
||||||
|
|
||||||
<Grid Width="220" Height="130" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="00,40,60,0" Visibility="Hidden" x:Name="countdownGrid">
|
<Grid Width="180" Height="90" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="00,20,40,0" Visibility="Hidden" x:Name="countdownGrid">
|
||||||
<Border Background="#005fff" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="30" />
|
<Border Background="#005fff" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="30" />
|
||||||
<TextBlock x:Name="countdownText"
|
<TextBlock x:Name="countdownText"
|
||||||
Text="60"
|
Text="60"
|
||||||
FontSize="120"
|
FontSize="80"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
Foreground="#fff"
|
Foreground="#fff"
|
||||||
FontStyle="Italic"
|
FontStyle="Italic"
|
||||||
@ -35,7 +35,7 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!--排行榜-->
|
<!--排行榜-->
|
||||||
<Grid x:Name="RankingGrid" Margin="0,0,0,0" Height="1080" Width="1920" Visibility="Visible">
|
<Grid x:Name="RankingGrid" Margin="0,0,0,0" Height="1080" Width="1920" Visibility="Hidden">
|
||||||
<Image
|
<Image
|
||||||
Source="/Resources/Img/test_img/one_rope/finish_img/finish_bg.png"
|
Source="/Resources/Img/test_img/one_rope/finish_img/finish_bg.png"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
|
|||||||
@ -170,21 +170,33 @@ namespace Wpf_AiSportsMicrospace.Views
|
|||||||
switch (_currentGameState)
|
switch (_currentGameState)
|
||||||
{
|
{
|
||||||
case GameState.NotStarted: // 未开始
|
case GameState.NotStarted: // 未开始
|
||||||
int rightWaving = DetectRightHandRaise(humans);
|
int leftWaving = DetectLeftHandRaise(humans);
|
||||||
if (rightWaving >= 3)
|
if (leftWaving == 5)
|
||||||
{
|
{
|
||||||
switch (rightWaving)
|
_mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
|
||||||
|
_mainWin.WebcamClient.StopExtract();
|
||||||
|
|
||||||
|
// 举左手逻辑,例如结束动画或退出
|
||||||
|
var newPage = new Home();
|
||||||
|
_mainWin?.SwitchPageWithMaskAnimation(newPage, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int rightWaving = DetectRightHandRaise(humans);
|
||||||
|
if (rightWaving >= 3)
|
||||||
{
|
{
|
||||||
case (int)WavingAction.FirstHand:
|
switch (rightWaving)
|
||||||
StartCountdown(3);
|
{
|
||||||
break;
|
case (int)WavingAction.FirstHand:
|
||||||
case (int)WavingAction.Raising:
|
StartCountdown(3);
|
||||||
UpdateCountdown();
|
break;
|
||||||
break;
|
case (int)WavingAction.Raising:
|
||||||
case (int)WavingAction.RaiseHand:
|
UpdateCountdown();
|
||||||
FinishCountdown();
|
break;
|
||||||
_currentGameState = GameState.Running; // 倒计时完成 → 游戏开始
|
case (int)WavingAction.RaiseHand:
|
||||||
break;
|
FinishCountdown();
|
||||||
|
_currentGameState = GameState.Running; // 倒计时完成 → 游戏开始
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -196,18 +208,18 @@ namespace Wpf_AiSportsMicrospace.Views
|
|||||||
// if (CheckGameFinished()) _currentGameState = GameState.Finished;
|
// if (CheckGameFinished()) _currentGameState = GameState.Finished;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GameState.Finished: // 游戏完成
|
//case GameState.Finished: // 游戏完成
|
||||||
int leftWaving = DetectLeftHandRaise(humans);
|
// int leftWaving = DetectLeftHandRaise(humans);
|
||||||
if (leftWaving == 5)
|
// if (leftWaving == 5)
|
||||||
{
|
// {
|
||||||
_mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
|
// _mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
|
||||||
_mainWin.WebcamClient.StopExtract();
|
// _mainWin.WebcamClient.StopExtract();
|
||||||
|
|
||||||
// 举左手逻辑,例如结束动画或退出
|
// // 举左手逻辑,例如结束动画或退出
|
||||||
var newPage = new Home();
|
// var newPage = new Home();
|
||||||
_mainWin?.SwitchPageWithMaskAnimation(newPage, true);
|
// _mainWin?.SwitchPageWithMaskAnimation(newPage, true);
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -283,7 +295,7 @@ namespace Wpf_AiSportsMicrospace.Views
|
|||||||
ShowRankingBoard(RankingItemList);
|
ShowRankingBoard(RankingItemList);
|
||||||
Utils.StopBackgroundMusic();
|
Utils.StopBackgroundMusic();
|
||||||
|
|
||||||
_currentGameState = GameState.Finished;
|
_currentGameState = GameState.NotStarted;
|
||||||
_mainWin.HumanFrameUpdated += OnHumanFrameUpdated;
|
_mainWin.HumanFrameUpdated += OnHumanFrameUpdated;
|
||||||
_mainWin.WebcamClient.StartExtract();
|
_mainWin.WebcamClient.StartExtract();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
|||||||
|
|
||||||
|
|
||||||
// 容忍时间(节拍误差)
|
// 容忍时间(节拍误差)
|
||||||
public double _beatTolerance = 0.15; // ±150ms
|
public double _beatTolerance = 0.2; // ±150ms
|
||||||
private int _totalDots = 0;
|
private int _totalDots = 0;
|
||||||
// 滚动显示的节拍点集合
|
// 滚动显示的节拍点集合
|
||||||
public ObservableCollection<BeatItem> BeatDisplayLeft { get; set; } = new();
|
public ObservableCollection<BeatItem> BeatDisplayLeft { get; set; } = new();
|
||||||
@ -171,21 +171,34 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
|||||||
switch (_currentGameState)
|
switch (_currentGameState)
|
||||||
{
|
{
|
||||||
case GameState.NotStarted: // 未开始
|
case GameState.NotStarted: // 未开始
|
||||||
int rightWaving = DetectRightHandRaise(humans);
|
int leftWaving = DetectLeftHandRaise(humans);
|
||||||
if (rightWaving >= 3)
|
if (leftWaving == 5)
|
||||||
{
|
{
|
||||||
switch (rightWaving)
|
_mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
|
||||||
|
_mainWin.WebcamClient.StopExtract();
|
||||||
|
|
||||||
|
// 举左手逻辑,例如结束动画或退出
|
||||||
|
var newPage = new Home();
|
||||||
|
_mainWin?.SwitchPageWithMaskAnimation(newPage, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int rightWaving = DetectRightHandRaise(humans);
|
||||||
|
if (rightWaving >= 3)
|
||||||
{
|
{
|
||||||
case (int)WavingAction.FirstHand:
|
switch (rightWaving)
|
||||||
StartCountdown(3);
|
{
|
||||||
break;
|
case (int)WavingAction.FirstHand:
|
||||||
case (int)WavingAction.Raising:
|
StartCountdown(3);
|
||||||
UpdateCountdown();
|
break;
|
||||||
break;
|
case (int)WavingAction.Raising:
|
||||||
case (int)WavingAction.RaiseHand:
|
UpdateCountdown();
|
||||||
FinishCountdown();
|
break;
|
||||||
_currentGameState = GameState.Running; // 倒计时完成 → 游戏开始
|
case (int)WavingAction.RaiseHand:
|
||||||
break;
|
FinishCountdown();
|
||||||
|
_currentGameState = GameState.Running; // 倒计时完成 → 游戏开始
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -197,18 +210,18 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
|||||||
// if (CheckGameFinished()) _currentGameState = GameState.Finished;
|
// if (CheckGameFinished()) _currentGameState = GameState.Finished;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GameState.Finished: // 游戏完成
|
//case GameState.Finished: // 游戏完成
|
||||||
int leftWaving = DetectLeftHandRaise(humans);
|
// int leftWaving = DetectLeftHandRaise(humans);
|
||||||
if (leftWaving == 5)
|
// if (leftWaving == 5)
|
||||||
{
|
// {
|
||||||
_mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
|
// _mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
|
||||||
_mainWin.WebcamClient.StopExtract();
|
// _mainWin.WebcamClient.StopExtract();
|
||||||
|
|
||||||
// 举左手逻辑,例如结束动画或退出
|
// // 举左手逻辑,例如结束动画或退出
|
||||||
var newPage = new Home();
|
// var newPage = new Home();
|
||||||
_mainWin?.SwitchPageWithMaskAnimation(newPage, true);
|
// _mainWin?.SwitchPageWithMaskAnimation(newPage, true);
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -288,7 +301,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
|||||||
|
|
||||||
|
|
||||||
// 更新游戏状态
|
// 更新游戏状态
|
||||||
_currentGameState = GameState.Finished;
|
_currentGameState = GameState.NotStarted;
|
||||||
|
|
||||||
// 恢复视频流
|
// 恢复视频流
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
@ -306,9 +319,9 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
|||||||
{
|
{
|
||||||
double left = _musicJumpRopeContext.UserBeatSyncList[0];
|
double left = _musicJumpRopeContext.UserBeatSyncList[0];
|
||||||
double right = _musicJumpRopeContext.UserBeatSyncList[1];
|
double right = _musicJumpRopeContext.UserBeatSyncList[1];
|
||||||
score3.Text = (left * 10).ToString();
|
score4.Text = (left * 10).ToString();
|
||||||
score4.Text = (right * 10).ToString();
|
score3.Text = (right * 10).ToString();
|
||||||
if (left < right)
|
if (left > right)
|
||||||
{
|
{
|
||||||
lose1.Margin = new Thickness(60, 0, 0, 0);
|
lose1.Margin = new Thickness(60, 0, 0, 0);
|
||||||
lose2.Margin = new Thickness(60, 0, 0, 0);
|
lose2.Margin = new Thickness(60, 0, 0, 0);
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Wpf_AiSportsMicrospace.Views"
|
xmlns:local="clr-namespace:Wpf_AiSportsMicrospace.Views"
|
||||||
xmlns:gif="http://wpfanimatedgif.codeplex.com"
|
xmlns:gif="http://wpfanimatedgif.codeplex.com"
|
||||||
|
WindowStyle="None"
|
||||||
mc:Ignorable="d" WindowState="Maximized">
|
mc:Ignorable="d" WindowState="Maximized">
|
||||||
<Grid>
|
<Grid>
|
||||||
<!-- 过渡容器 -->
|
<!-- 过渡容器 -->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user