滚动的点,初始版
This commit is contained in:
parent
eef77b8995
commit
0e8c41fb61
@ -50,6 +50,8 @@ namespace Dto
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public Dictionary<int, List<double>> MusicBeatsDic;
|
||||||
|
|
||||||
public MusicJumpRopeContext()
|
public MusicJumpRopeContext()
|
||||||
{
|
{
|
||||||
CirclePositions = new List<(double XNorm, double YNorm)>
|
CirclePositions = new List<(double XNorm, double YNorm)>
|
||||||
@ -58,6 +60,8 @@ namespace Dto
|
|||||||
(0.50, 0.88),
|
(0.50, 0.88),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MusicBeatsDic = MusicBeats["1"].GroupBy(b => (int)Math.Ceiling(b) - 1).ToDictionary(g => g.Key, g => g.ToList());
|
||||||
|
|
||||||
UserList = new List<SportUserItem>();
|
UserList = new List<SportUserItem>();
|
||||||
UserNumberList = new List<string>();
|
UserNumberList = new List<string>();
|
||||||
Sports = new List<SportBase>();
|
Sports = new List<SportBase>();
|
||||||
|
|||||||
@ -216,7 +216,7 @@ namespace Wpf_AiSportsMicrospace.Views
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _currentCountdown = 3;
|
private double _currentCountdown = 3600;
|
||||||
private DateTime _lastUpdateTime = DateTime.Now;
|
private DateTime _lastUpdateTime = DateTime.Now;
|
||||||
private void StartCountdown(int start = 3)
|
private void StartCountdown(int start = 3)
|
||||||
{
|
{
|
||||||
@ -233,10 +233,10 @@ namespace Wpf_AiSportsMicrospace.Views
|
|||||||
|
|
||||||
private void UpdateCountdown()
|
private void UpdateCountdown()
|
||||||
{
|
{
|
||||||
if ((DateTime.Now - _lastUpdateTime).TotalSeconds >= 1)
|
if ((DateTime.Now - _lastUpdateTime).TotalMilliseconds >= 600)
|
||||||
{
|
{
|
||||||
_lastUpdateTime = DateTime.Now;
|
_lastUpdateTime = DateTime.Now;
|
||||||
_currentCountdown--;
|
_currentCountdown -= 600;
|
||||||
|
|
||||||
if (_currentCountdown > 0)
|
if (_currentCountdown > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -234,10 +234,11 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
|||||||
private DateTime _lastUpdateTime = DateTime.Now;
|
private DateTime _lastUpdateTime = DateTime.Now;
|
||||||
private void StartCountdown(int start = 3)
|
private void StartCountdown(int start = 3)
|
||||||
{
|
{
|
||||||
_currentCountdown = start;
|
_mainWin.ShowCountDownAnimation();
|
||||||
countdownText.Text = _currentCountdown.ToString();
|
//_currentCountdown = start;
|
||||||
countdownGrid.Visibility = Visibility.Visible;
|
//countdownText.Text = _currentCountdown.ToString();
|
||||||
_lastUpdateTime = DateTime.Now;
|
//countdownGrid.Visibility = Visibility.Visible;
|
||||||
|
//_lastUpdateTime = DateTime.Now;
|
||||||
Utils.PlayBackgroundMusic("countdown_3.mp3", false);
|
Utils.PlayBackgroundMusic("countdown_3.mp3", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +277,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
|||||||
// 播放背景音乐(循环)
|
// 播放背景音乐(循环)
|
||||||
Utils.PlayBackgroundMusic("1.MP3", true);
|
Utils.PlayBackgroundMusic("1.MP3", true);
|
||||||
|
|
||||||
//StartBeatScrollTimer();
|
StartBeatScrollTimer();
|
||||||
|
|
||||||
for (int i = seconds; i >= 0; i--)
|
for (int i = seconds; i >= 0; i--)
|
||||||
{
|
{
|
||||||
@ -685,7 +686,6 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
|||||||
var beats = _musicJumpRopeContext.MusicBeats["1"];
|
var beats = _musicJumpRopeContext.MusicBeats["1"];
|
||||||
double lastX = 0;
|
double lastX = 0;
|
||||||
double scale = 300; // 间隔放大系数,可调
|
double scale = 300; // 间隔放大系数,可调
|
||||||
|
|
||||||
for (int i = 0; i < beats.Count; i++)
|
for (int i = 0; i < beats.Count; i++)
|
||||||
{
|
{
|
||||||
double interval = i == 0 ? beats[0] : beats[i] - beats[i - 1];
|
double interval = i == 0 ? beats[0] : beats[i] - beats[i - 1];
|
||||||
@ -730,6 +730,7 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
|||||||
beatCanvasRight.Children.Add(rightEllipse);
|
beatCanvasRight.Children.Add(rightEllipse);
|
||||||
}
|
}
|
||||||
beatCanvasRight.Width = totalWidth;
|
beatCanvasRight.Width = totalWidth;
|
||||||
|
|
||||||
}
|
}
|
||||||
private DispatcherTimer _beatScrollTimer;
|
private DispatcherTimer _beatScrollTimer;
|
||||||
private double totalTime = 108.455; // 音乐总时长
|
private double totalTime = 108.455; // 音乐总时长
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user