Merge branch 'dev' of http://8.153.108.90:3000/YD/Wpf_AiSportsMicrospace into dev
This commit is contained in:
commit
c3a70dc612
@ -170,6 +170,17 @@ namespace Wpf_AiSportsMicrospace.Views
|
|||||||
switch (_currentGameState)
|
switch (_currentGameState)
|
||||||
{
|
{
|
||||||
case GameState.NotStarted: // 未开始
|
case GameState.NotStarted: // 未开始
|
||||||
|
int leftWaving = DetectLeftHandRaise(humans);
|
||||||
|
if (leftWaving == 5)
|
||||||
|
{
|
||||||
|
_mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
|
||||||
|
_mainWin.WebcamClient.StopExtract();
|
||||||
|
|
||||||
|
// 举左手逻辑,例如结束动画或退出
|
||||||
|
var newPage = new Home();
|
||||||
|
_mainWin?.SwitchPageWithMaskAnimation(newPage, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
int rightWaving = DetectRightHandRaise(humans);
|
int rightWaving = DetectRightHandRaise(humans);
|
||||||
if (rightWaving >= 3)
|
if (rightWaving >= 3)
|
||||||
{
|
{
|
||||||
@ -187,6 +198,7 @@ namespace Wpf_AiSportsMicrospace.Views
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GameState.Running: // 游戏进行中
|
case GameState.Running: // 游戏进行中
|
||||||
@ -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.Running;
|
||||||
_mainWin.HumanFrameUpdated += OnHumanFrameUpdated;
|
_mainWin.HumanFrameUpdated += OnHumanFrameUpdated;
|
||||||
_mainWin.WebcamClient.StartExtract();
|
_mainWin.WebcamClient.StartExtract();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -171,6 +171,18 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
|||||||
switch (_currentGameState)
|
switch (_currentGameState)
|
||||||
{
|
{
|
||||||
case GameState.NotStarted: // 未开始
|
case GameState.NotStarted: // 未开始
|
||||||
|
int leftWaving = DetectLeftHandRaise(humans);
|
||||||
|
if (leftWaving == 5)
|
||||||
|
{
|
||||||
|
_mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
|
||||||
|
_mainWin.WebcamClient.StopExtract();
|
||||||
|
|
||||||
|
// 举左手逻辑,例如结束动画或退出
|
||||||
|
var newPage = new Home();
|
||||||
|
_mainWin?.SwitchPageWithMaskAnimation(newPage, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
int rightWaving = DetectRightHandRaise(humans);
|
int rightWaving = DetectRightHandRaise(humans);
|
||||||
if (rightWaving >= 3)
|
if (rightWaving >= 3)
|
||||||
{
|
{
|
||||||
@ -188,6 +200,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GameState.Running: // 游戏进行中
|
case GameState.Running: // 游戏进行中
|
||||||
@ -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.Running;
|
||||||
|
|
||||||
// 恢复视频流
|
// 恢复视频流
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user