private void BottonDetectGameOverOk_Click(object sender, RoutedEventArgs e) { BgRun.IsGameOver = false; StoryboardDetectGameOver.Stop(); StoryboardDetectGameNewScore.Stop(); StoryboardDetectGameNewScoreZoom.Stop(); }
private void DetectTimer_Tick(object sender, EventArgs e) { if (_detectTimes > 3 && (_timePointTemp - _timePoint).TotalMilliseconds / (_detectTimes - 1) < 1000 && DateTime.Now - _timePointTemp > TimeSpan.FromSeconds(1.2)) { DetectStop(); } else if (DateTime.Now - _timePointTemp > TimeSpan.FromSeconds(2.3)) { DetectStop(); } else { TimeSpan ts = DateTime.Now - _timePoint; TextDetect.Text = string.Format("检测时间:{0}:{1}.{2}\r\n检测次数:{3}次\r\n", ts.Minutes, ts.Seconds, ts.Milliseconds, _detectTimes); if (_detectTimes > 3) { TextDetect.Text += string.Format("测试结果:{0} BPM\r\n", Math.Round(_bpmtemp, 0)); string quickTip = ""; if (_bpmtemp > 300) { if (_bpmtemp < 380) { quickTip = "你的速度太慢啦!"; } else if (_bpmtemp >= 380 && _bpmtemp < 450) { quickTip = "马马虎虎的速度"; } else if (_bpmtemp >= 450 && _bpmtemp < 540) { quickTip = "飞一般的速度!"; } else if (_bpmtemp >= 540 && _bpmtemp < 630) { quickTip = "闪电般的速度!!"; } else if (_bpmtemp >= 630 && _bpmtemp < 750) { quickTip = "神一般的速度!!!"; } else if (_bpmtemp >= 750) { quickTip = "神的速度!!!!"; } double leftSec = 10 - Math.Floor((DateTime.Now - _timePoint).TotalSeconds); TextDetect.Text += string.Format("{0}\r\n倒计时:{1}秒", quickTip, leftSec); if (leftSec <= 0 && _bpmtemp > 300) { if (_bpmtemp < 380) { quickTip = "休闲玩家"; } else if (_bpmtemp >= 380 && _bpmtemp < 450) { quickTip = "萌音战士"; } else if (_bpmtemp >= 450 && _bpmtemp < 540) { quickTip = "快刀斗士"; } else if (_bpmtemp >= 540 && _bpmtemp < 630) { quickTip = "闪电骑士"; } else if (_bpmtemp >= 630 && _bpmtemp < 750) { quickTip = "帕金森患者"; } else if (_bpmtemp >= 750) { quickTip = "神之手指"; } TextDetectGame.Text = string.Format("游戏结束!\r\n你在10秒内按键次数为{0}次,BPM为{1}\r\n恭喜你获得“{2}”称号!", _detectTimes, Math.Round(_bpmtemp), quickTip); StoryboardDetectGameOver.Begin(); if (Math.Round(_bpmtemp) > Convert.ToDouble(settings["HighestScore"])) { StoryboardDetectGameNewScore.Begin(); StoryboardDetectGameNewScoreZoom.Begin(); TextDetectGameScore.Text = string.Format("新纪录!{0} BPM\r\n原纪录:{1} BPM", Math.Round(_bpmtemp), settings["HighestScore"]); settings["HighestScore"] = Math.Round(_bpmtemp); settings.Save(); UpdateTile(); } else { StoryboardDetectGameNewScore.Begin(); TextDetectGameScore.Text = string.Format("最高纪录:{0} BPM", settings["HighestScore"]); } BgRun.IsGameOver = true; DetectStop(); } } } } }