This commit is contained in:
tanglong 2026-03-30 15:41:11 +08:00
commit 183d463fba
3 changed files with 17 additions and 32 deletions

View File

@ -243,7 +243,6 @@ namespace Wpf_AiSportsMicrospace.Views
private async void StartCountdown(int start = 3) private async void StartCountdown(int start = 3)
{ {
_mainWin.ShowCountDownAnimation(); _mainWin.ShowCountDownAnimation();
//_currentCountdown = start; //_currentCountdown = start;
Utils.PlayBackgroundMusic("countdown_3.mp3", false); Utils.PlayBackgroundMusic("countdown_3.mp3", false);
@ -363,6 +362,7 @@ namespace Wpf_AiSportsMicrospace.Views
_groupJumpRopeContext.Sports.Add(sport); _groupJumpRopeContext.Sports.Add(sport);
} }
} }
//private void UpdateCircleCounts(List<Human> humans) //private void UpdateCircleCounts(List<Human> humans)
//{ //{
// if (humans == null || humans.Count == 0) // if (humans == null || humans.Count == 0)

View File

@ -201,18 +201,9 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
switch (rightWaving) switch (rightWaving)
{ {
case (int)WavingAction.FirstHand: case (int)WavingAction.FirstHand:
if (!_isCountdownStarted) _currentGameState = GameState.Running;
{
StartCountdown(3); StartCountdown(3);
} _isCountdownStarted = true; // 倒计时开始,停止左手检测
break;
case (int)WavingAction.Raising:
//UpdateCountdown();
break;
case (int)WavingAction.RaiseHand:
//FinishCountdown();
//_currentGameState = GameState.Running;
break; break;
} }
} }

View File

@ -210,16 +210,10 @@ namespace Views.SquatFu
switch (rightWaving) switch (rightWaving)
{ {
case (int)WavingAction.FirstHand: case (int)WavingAction.FirstHand:
_currentGameState = GameState.Running;
StartCountdown(3); StartCountdown(3);
_isCountdownStarted = true; // 倒计时开始,停止左手检测 _isCountdownStarted = true; // 倒计时开始,停止左手检测
break; break;
//case (int)WavingAction.Raising:
// UpdateCountdown();
// break;
//case (int)WavingAction.RaiseHand:
// FinishCountdown();
// _currentGameState = GameState.Running; // 倒计时完成 → 游戏开始
// break;
} }
} }
break; break;
@ -227,19 +221,19 @@ namespace Views.SquatFu
case GameState.Running: // 游戏进行中 case GameState.Running: // 游戏进行中
UpdateCircleCounts(humans); UpdateCircleCounts(humans);
break; break;
case GameState.Finished: // 游戏结束 //case GameState.Finished: // 游戏结束
int leftWave = sportOperate.VerifyLeftWavingAction(humans); // int leftWave = sportOperate.VerifyLeftWavingAction(humans);
if (leftWave == 5) // if (leftWave == 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);
return; // 提前退出 // return; // 提前退出
} // }
break; // break;
} }
} }
catch (Exception ex) catch (Exception ex)