音乐
This commit is contained in:
parent
0dbf676ed0
commit
eb5df730d1
BIN
Wpf_AiSportsMicrospace/Resources/Music/whackamole.mp3
Normal file
BIN
Wpf_AiSportsMicrospace/Resources/Music/whackamole.mp3
Normal file
Binary file not shown.
@ -509,73 +509,100 @@ namespace Wpf_AiSportsMicrospace.Views
|
|||||||
|
|
||||||
public void ShowRankingBoard(List<RankItem> list)
|
public void ShowRankingBoard(List<RankItem> list)
|
||||||
{
|
{
|
||||||
var scoreGrid = FindName("ScoreGrid") as Grid;
|
if (list == null || list.Count == 0) return;
|
||||||
name1.Text = list[0].Name;
|
|
||||||
name2.Text = list[1].Name;
|
// 排序(建议加上)
|
||||||
name3.Text = list[2].Name;
|
list = list.OrderByDescending(x => x.Number).ToList();
|
||||||
number1.Text = list[0].Number.ToString();
|
|
||||||
number2.Text = list[1].Number.ToString();
|
// 清空旧UI
|
||||||
number3.Text = list[2].Number.ToString();
|
ScoreGrid.Children.Clear();
|
||||||
foreach (var item in list)
|
|
||||||
|
// ===== 前三名(完全动态,永不越界)=====
|
||||||
|
var nameControls = new[] { name1, name2, name3 };
|
||||||
|
var numberControls = new[] { number1, number2, number3 };
|
||||||
|
|
||||||
|
for (int i = 0; i < nameControls.Length; i++)
|
||||||
{
|
{
|
||||||
|
var item = list.ElementAtOrDefault(i);
|
||||||
|
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
nameControls[i].Text = item.Name;
|
||||||
|
numberControls[i].Text = item.Number.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 不够3个时填空
|
||||||
|
nameControls[i].Text = "-";
|
||||||
|
numberControls[i].Text = "-";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== 榜单列表 =====
|
||||||
|
for (int i = 0; i < list.Count; i++)
|
||||||
|
{
|
||||||
|
var item = list[i];
|
||||||
|
|
||||||
var grid = new Grid
|
var grid = new Grid
|
||||||
{
|
{
|
||||||
Width = 1344,
|
Width = 1344,
|
||||||
Height = 71,
|
Height = 71,
|
||||||
HorizontalAlignment = HorizontalAlignment.Center,
|
HorizontalAlignment = HorizontalAlignment.Center,
|
||||||
VerticalAlignment = VerticalAlignment.Top,
|
VerticalAlignment = VerticalAlignment.Top,
|
||||||
Margin = new Thickness(0, 69 * item.Rank, 0, 0)
|
Margin = new Thickness(0, 69 * i, 0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
var border = new Border
|
var border = new Border
|
||||||
{
|
{
|
||||||
Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff"))
|
Background = new SolidColorBrush(
|
||||||
|
(Color)ColorConverter.ConvertFromString("#FFFFFF"))
|
||||||
};
|
};
|
||||||
grid.Children.Add(border);
|
grid.Children.Add(border);
|
||||||
var rankText = new TextBlock
|
|
||||||
|
// 排名
|
||||||
|
grid.Children.Add(new TextBlock
|
||||||
{
|
{
|
||||||
Text = item.Rank.ToString(),
|
Text = (i + 1).ToString(),
|
||||||
FontSize = 24,
|
FontSize = 24,
|
||||||
FontWeight = FontWeights.Bold,
|
FontWeight = FontWeights.Bold,
|
||||||
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#999999")),
|
Foreground = new SolidColorBrush(
|
||||||
|
(Color)ColorConverter.ConvertFromString("#999999")),
|
||||||
HorizontalAlignment = HorizontalAlignment.Left,
|
HorizontalAlignment = HorizontalAlignment.Left,
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
VerticalAlignment = VerticalAlignment.Center,
|
||||||
TextAlignment = TextAlignment.Center,
|
Width = 200,
|
||||||
Width = 200
|
TextAlignment = TextAlignment.Center
|
||||||
};
|
});
|
||||||
grid.Children.Add(rankText);
|
|
||||||
|
|
||||||
var positionText = new TextBlock
|
// 名字
|
||||||
|
grid.Children.Add(new TextBlock
|
||||||
{
|
{
|
||||||
Text = item.Name,
|
Text = item.Name,
|
||||||
FontSize = 24,
|
FontSize = 24,
|
||||||
FontWeight = FontWeights.Bold,
|
FontWeight = FontWeights.Bold,
|
||||||
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#999999")),
|
Foreground = new SolidColorBrush(
|
||||||
|
(Color)ColorConverter.ConvertFromString("#999999")),
|
||||||
HorizontalAlignment = HorizontalAlignment.Center,
|
HorizontalAlignment = HorizontalAlignment.Center,
|
||||||
VerticalAlignment = VerticalAlignment.Center
|
VerticalAlignment = VerticalAlignment.Center
|
||||||
};
|
});
|
||||||
grid.Children.Add(positionText);
|
|
||||||
|
|
||||||
var scoreText = new TextBlock
|
// 分数
|
||||||
|
grid.Children.Add(new TextBlock
|
||||||
{
|
{
|
||||||
Text = item.Number.ToString(),
|
Text = item.Number.ToString(),
|
||||||
FontSize = 24,
|
FontSize = 24,
|
||||||
FontWeight = FontWeights.Bold,
|
FontWeight = FontWeights.Bold,
|
||||||
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#999999")),
|
Foreground = new SolidColorBrush(
|
||||||
|
(Color)ColorConverter.ConvertFromString("#999999")),
|
||||||
HorizontalAlignment = HorizontalAlignment.Right,
|
HorizontalAlignment = HorizontalAlignment.Right,
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
VerticalAlignment = VerticalAlignment.Center,
|
||||||
TextAlignment = TextAlignment.Center,
|
Width = 200,
|
||||||
Width = 200
|
TextAlignment = TextAlignment.Center
|
||||||
};
|
});
|
||||||
grid.Children.Add(scoreText);
|
|
||||||
ScoreGrid.Children.Add(grid);
|
ScoreGrid.Children.Add(grid);
|
||||||
}
|
}
|
||||||
showElement("RankingGrid");
|
|
||||||
//var rankingGrid = FindName("RankingGrid") as Grid;
|
|
||||||
//if (rankingGrid == null) return;
|
|
||||||
|
|
||||||
//rankingGrid.Visibility = Visibility.Visible;
|
showElement("RankingGrid");
|
||||||
//var fadeIn = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(600));
|
|
||||||
//rankingGrid.BeginAnimation(UIElement.OpacityProperty, fadeIn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -354,8 +354,6 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
|||||||
// 停止实时检测和视频流
|
// 停止实时检测和视频流
|
||||||
|
|
||||||
countdownGrid.Visibility = Visibility.Hidden;
|
countdownGrid.Visibility = Visibility.Hidden;
|
||||||
_mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
|
|
||||||
_mainWin.WebcamClient.StopExtract();
|
|
||||||
|
|
||||||
// 计算排名
|
// 计算排名
|
||||||
var rankList = _musicJumpRopeContext.UpdateRankList();
|
var rankList = _musicJumpRopeContext.UpdateRankList();
|
||||||
@ -366,15 +364,17 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
|
|||||||
_currentGameState = GameState.NotStarted;
|
_currentGameState = GameState.NotStarted;
|
||||||
_isCountdownStarted = false;
|
_isCountdownStarted = false;
|
||||||
|
|
||||||
|
showRank();
|
||||||
|
|
||||||
// 恢复视频流
|
// 恢复视频流
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
//Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
//{
|
||||||
_mainWin.HumanFrameUpdated += OnHumanFrameUpdated;
|
// _mainWin.HumanFrameUpdated += OnHumanFrameUpdated;
|
||||||
_mainWin.WebcamClient.StartExtract();
|
// _mainWin.WebcamClient.StartExtract();
|
||||||
showRank();
|
// showRank();
|
||||||
// 更新 UI(排行榜或分数板)
|
// // 更新 UI(排行榜或分数板)
|
||||||
// ShowRankingBoard(rankList);
|
// // ShowRankingBoard(rankList);
|
||||||
});
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showRank()
|
public void showRank()
|
||||||
|
|||||||
@ -103,67 +103,91 @@ namespace Views.JumpRope
|
|||||||
}
|
}
|
||||||
public void ShowRankingBoard(List<RankItem> list)
|
public void ShowRankingBoard(List<RankItem> list)
|
||||||
{
|
{
|
||||||
|
|
||||||
var scoreGrid = FindName("ScoreGrid") as Grid;
|
var scoreGrid = FindName("ScoreGrid") as Grid;
|
||||||
if (list.Count <= 0) return;
|
if (scoreGrid == null || list == null || list.Count == 0) return;
|
||||||
name1.Text = list[0].Name;
|
|
||||||
name2.Text = list[1].Name;
|
// 排序(建议加)
|
||||||
name3.Text = list[2].Name;
|
list = list.OrderByDescending(x => x.Number).ToList();
|
||||||
number1.Text = list[0].Number.ToString();
|
|
||||||
number2.Text = list[1].Number.ToString();
|
// 清空旧数据(必须)
|
||||||
number3.Text = list[2].Number.ToString();
|
scoreGrid.Children.Clear();
|
||||||
foreach (var item in list)
|
|
||||||
|
// ===== 前三名(完全动态,不越界)=====
|
||||||
|
var nameControls = new[] { name1, name2, name3 };
|
||||||
|
var numberControls = new[] { number1, number2, number3 };
|
||||||
|
|
||||||
|
for (int i = 0; i < nameControls.Length; i++)
|
||||||
{
|
{
|
||||||
|
var item = list.ElementAtOrDefault(i);
|
||||||
|
|
||||||
|
nameControls[i].Text = item?.Name ?? "-";
|
||||||
|
numberControls[i].Text = item?.Number.ToString() ?? "-";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== 榜单列表 =====
|
||||||
|
for (int i = 0; i < list.Count; i++)
|
||||||
|
{
|
||||||
|
var item = list[i];
|
||||||
|
|
||||||
var grid = new Grid
|
var grid = new Grid
|
||||||
{
|
{
|
||||||
Width = 1344,
|
Width = 1344,
|
||||||
Height = 71,
|
Height = 71,
|
||||||
HorizontalAlignment = HorizontalAlignment.Center,
|
HorizontalAlignment = HorizontalAlignment.Center,
|
||||||
VerticalAlignment = VerticalAlignment.Top,
|
VerticalAlignment = VerticalAlignment.Top,
|
||||||
Margin = new Thickness(0, 69 * item.Rank, 0, 0)
|
|
||||||
|
// ❗不要用 item.Rank,改用 i
|
||||||
|
Margin = new Thickness(0, 69 * i, 0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
var border = new Border
|
var border = new Border
|
||||||
{
|
{
|
||||||
Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff"))
|
Background = new SolidColorBrush(
|
||||||
|
(Color)ColorConverter.ConvertFromString("#FFFFFF"))
|
||||||
};
|
};
|
||||||
grid.Children.Add(border);
|
grid.Children.Add(border);
|
||||||
var rankText = new TextBlock
|
|
||||||
|
// 排名
|
||||||
|
grid.Children.Add(new TextBlock
|
||||||
{
|
{
|
||||||
Text = item.Rank.ToString(),
|
Text = (i + 1).ToString(), // 用 i+1
|
||||||
FontSize = 24,
|
FontSize = 24,
|
||||||
FontWeight = FontWeights.Bold,
|
FontWeight = FontWeights.Bold,
|
||||||
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#999999")),
|
Foreground = new SolidColorBrush(
|
||||||
|
(Color)ColorConverter.ConvertFromString("#999999")),
|
||||||
HorizontalAlignment = HorizontalAlignment.Left,
|
HorizontalAlignment = HorizontalAlignment.Left,
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
VerticalAlignment = VerticalAlignment.Center,
|
||||||
TextAlignment = TextAlignment.Center,
|
TextAlignment = TextAlignment.Center,
|
||||||
Width = 200
|
Width = 200
|
||||||
};
|
});
|
||||||
grid.Children.Add(rankText);
|
|
||||||
|
|
||||||
var positionText = new TextBlock
|
// 名字
|
||||||
|
grid.Children.Add(new TextBlock
|
||||||
{
|
{
|
||||||
Text = item.Name,
|
Text = item.Name,
|
||||||
FontSize = 24,
|
FontSize = 24,
|
||||||
FontWeight = FontWeights.Bold,
|
FontWeight = FontWeights.Bold,
|
||||||
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#999999")),
|
Foreground = new SolidColorBrush(
|
||||||
|
(Color)ColorConverter.ConvertFromString("#999999")),
|
||||||
HorizontalAlignment = HorizontalAlignment.Center,
|
HorizontalAlignment = HorizontalAlignment.Center,
|
||||||
VerticalAlignment = VerticalAlignment.Center
|
VerticalAlignment = VerticalAlignment.Center
|
||||||
};
|
});
|
||||||
grid.Children.Add(positionText);
|
|
||||||
|
|
||||||
var scoreText = new TextBlock
|
// 分数
|
||||||
|
grid.Children.Add(new TextBlock
|
||||||
{
|
{
|
||||||
Text = item.Number.ToString(),
|
Text = item.Number.ToString(),
|
||||||
FontSize = 24,
|
FontSize = 24,
|
||||||
FontWeight = FontWeights.Bold,
|
FontWeight = FontWeights.Bold,
|
||||||
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#999999")),
|
Foreground = new SolidColorBrush(
|
||||||
|
(Color)ColorConverter.ConvertFromString("#999999")),
|
||||||
HorizontalAlignment = HorizontalAlignment.Right,
|
HorizontalAlignment = HorizontalAlignment.Right,
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
VerticalAlignment = VerticalAlignment.Center,
|
||||||
TextAlignment = TextAlignment.Center,
|
TextAlignment = TextAlignment.Center,
|
||||||
Width = 200
|
Width = 200
|
||||||
};
|
});
|
||||||
grid.Children.Add(scoreText);
|
|
||||||
ScoreGrid.Children.Add(grid);
|
scoreGrid.Children.Add(grid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -308,9 +308,6 @@ namespace Views.JumpingJack
|
|||||||
x.ImageState = "1";
|
x.ImageState = "1";
|
||||||
});
|
});
|
||||||
|
|
||||||
_mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
|
|
||||||
_mainWin.WebcamClient.StopExtract();
|
|
||||||
|
|
||||||
RankingItemList = _groupJumpRopeContext.UpdateRankList();
|
RankingItemList = _groupJumpRopeContext.UpdateRankList();
|
||||||
ShowRankingBoard(RankingItemList);
|
ShowRankingBoard(RankingItemList);
|
||||||
Utils.StopBackgroundMusic();
|
Utils.StopBackgroundMusic();
|
||||||
@ -318,8 +315,6 @@ namespace Views.JumpingJack
|
|||||||
_currentGameState = GameState.NotStarted;
|
_currentGameState = GameState.NotStarted;
|
||||||
|
|
||||||
_isCountdownStarted = false;
|
_isCountdownStarted = false;
|
||||||
_mainWin.HumanFrameUpdated += OnHumanFrameUpdated;
|
|
||||||
_mainWin.WebcamClient.StartExtract();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateTime? _raiseStartTime;
|
private DateTime? _raiseStartTime;
|
||||||
|
|||||||
@ -113,7 +113,6 @@ namespace Views.SquatFu
|
|||||||
_mediaPlayer.MediaEnded += MediaPlayer_MediaEnded;
|
_mediaPlayer.MediaEnded += MediaPlayer_MediaEnded;
|
||||||
//_mainWin.WebcamClient.StartExtract();
|
//_mainWin.WebcamClient.StartExtract();
|
||||||
_mediaPlayer.Play();
|
_mediaPlayer.Play();
|
||||||
_mainWin.HumanFrameUpdated += OnHumanFrameUpdated;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private void ShowCenterTip(string imagePath, TimeSpan duration)
|
private void ShowCenterTip(string imagePath, TimeSpan duration)
|
||||||
@ -220,19 +219,6 @@ namespace Views.SquatFu
|
|||||||
case GameState.Running: // 游戏进行中
|
case GameState.Running: // 游戏进行中
|
||||||
UpdateCircleCounts(humans);
|
UpdateCircleCounts(humans);
|
||||||
break;
|
break;
|
||||||
//case GameState.Finished: // 游戏结束
|
|
||||||
// int leftWave = sportOperate.VerifyLeftWavingAction(humans);
|
|
||||||
// if (leftWave == 5)
|
|
||||||
// {
|
|
||||||
// _mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
|
|
||||||
// _mainWin.WebcamClient.StopExtract();
|
|
||||||
|
|
||||||
// // 举左手逻辑,例如结束动画或退出
|
|
||||||
// var newPage = new Home();
|
|
||||||
// _mainWin?.SwitchPageWithMaskAnimation(newPage, true);
|
|
||||||
// return; // 提前退出
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -245,9 +231,6 @@ namespace Views.SquatFu
|
|||||||
private DateTime _lastUpdateTime = DateTime.Now;
|
private DateTime _lastUpdateTime = DateTime.Now;
|
||||||
private async void StartCountdown(int start = 3)
|
private async void StartCountdown(int start = 3)
|
||||||
{
|
{
|
||||||
|
|
||||||
//_currentGameState = GameState.Running;
|
|
||||||
|
|
||||||
_mainWin.ShowCountDownAnimation();
|
_mainWin.ShowCountDownAnimation();
|
||||||
|
|
||||||
Utils.PlayBackgroundMusic("countdown_3.mp3", false);
|
Utils.PlayBackgroundMusic("countdown_3.mp3", false);
|
||||||
@ -287,23 +270,6 @@ namespace Views.SquatFu
|
|||||||
FinishCountdown();
|
FinishCountdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateCountdown()
|
|
||||||
{
|
|
||||||
if ((DateTime.Now - _lastUpdateTime).TotalMilliseconds >= 600)
|
|
||||||
{
|
|
||||||
_lastUpdateTime = DateTime.Now;
|
|
||||||
_currentCountdown -= 600;
|
|
||||||
|
|
||||||
if (_currentCountdown > 0)
|
|
||||||
{
|
|
||||||
countdownText.Text = _currentCountdown.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FinishCountdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private System.Timers.Timer _gameTimer;
|
private System.Timers.Timer _gameTimer;
|
||||||
private Random _random = new Random();
|
private Random _random = new Random();
|
||||||
@ -381,18 +347,13 @@ namespace Views.SquatFu
|
|||||||
//x.TriggerValue = Tiggle;
|
//x.TriggerValue = Tiggle;
|
||||||
});
|
});
|
||||||
|
|
||||||
_mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
|
|
||||||
_mainWin.WebcamClient.StopExtract();
|
|
||||||
|
|
||||||
RankingItemList = _WhackAMoleContext.UpdateWhackAMoleRankList();
|
RankingItemList = _WhackAMoleContext.UpdateWhackAMoleRankList();
|
||||||
ShowRankingBoard(RankingItemList);
|
ShowRankingBoard(RankingItemList);
|
||||||
Utils.StopBackgroundMusic();
|
Utils.StopBackgroundMusic();
|
||||||
|
|
||||||
_currentGameState = GameState.Finished;
|
_currentGameState = GameState.NotStarted;
|
||||||
|
|
||||||
_isCountdownStarted = false;
|
_isCountdownStarted = false;
|
||||||
_mainWin.HumanFrameUpdated += OnHumanFrameUpdated;
|
|
||||||
_mainWin.WebcamClient.StartExtract();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateTime? _raiseStartTime;
|
private DateTime? _raiseStartTime;
|
||||||
@ -545,77 +506,102 @@ namespace Views.SquatFu
|
|||||||
//return userItem; //
|
//return userItem; //
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void ShowRankingBoard(List<RankItem> list)
|
public void ShowRankingBoard(List<RankItem> list)
|
||||||
{
|
{
|
||||||
var scoreGrid = FindName("ScoreGrid") as Grid;
|
if (list == null || list.Count == 0) return;
|
||||||
name1.Text = list[0].Name;
|
|
||||||
name2.Text = list[1].Name;
|
// 排序(建议加上)
|
||||||
name3.Text = list[2].Name;
|
list = list.OrderByDescending(x => x.Number).ToList();
|
||||||
number1.Text = list[0].Number.ToString();
|
|
||||||
number2.Text = list[1].Number.ToString();
|
// 清空旧UI
|
||||||
number3.Text = list[2].Number.ToString();
|
ScoreGrid.Children.Clear();
|
||||||
foreach (var item in list)
|
|
||||||
|
// ===== 前三名(完全动态,永不越界)=====
|
||||||
|
var nameControls = new[] { name1, name2, name3 };
|
||||||
|
var numberControls = new[] { number1, number2, number3 };
|
||||||
|
|
||||||
|
for (int i = 0; i < nameControls.Length; i++)
|
||||||
{
|
{
|
||||||
|
var item = list.ElementAtOrDefault(i);
|
||||||
|
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
nameControls[i].Text = item.Name;
|
||||||
|
numberControls[i].Text = item.Number.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 不够3个时填空
|
||||||
|
nameControls[i].Text = "-";
|
||||||
|
numberControls[i].Text = "-";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===== 榜单列表 =====
|
||||||
|
for (int i = 0; i < list.Count; i++)
|
||||||
|
{
|
||||||
|
var item = list[i];
|
||||||
|
|
||||||
var grid = new Grid
|
var grid = new Grid
|
||||||
{
|
{
|
||||||
Width = 1344,
|
Width = 1344,
|
||||||
Height = 71,
|
Height = 71,
|
||||||
HorizontalAlignment = HorizontalAlignment.Center,
|
HorizontalAlignment = HorizontalAlignment.Center,
|
||||||
VerticalAlignment = VerticalAlignment.Top,
|
VerticalAlignment = VerticalAlignment.Top,
|
||||||
Margin = new Thickness(0, 69 * item.Rank, 0, 0)
|
Margin = new Thickness(0, 69 * i, 0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
var border = new Border
|
var border = new Border
|
||||||
{
|
{
|
||||||
Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff"))
|
Background = new SolidColorBrush(
|
||||||
|
(Color)ColorConverter.ConvertFromString("#FFFFFF"))
|
||||||
};
|
};
|
||||||
grid.Children.Add(border);
|
grid.Children.Add(border);
|
||||||
var rankText = new TextBlock
|
|
||||||
|
// 排名
|
||||||
|
grid.Children.Add(new TextBlock
|
||||||
{
|
{
|
||||||
Text = item.Rank.ToString(),
|
Text = (i + 1).ToString(),
|
||||||
FontSize = 24,
|
FontSize = 24,
|
||||||
FontWeight = FontWeights.Bold,
|
FontWeight = FontWeights.Bold,
|
||||||
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#999999")),
|
Foreground = new SolidColorBrush(
|
||||||
|
(Color)ColorConverter.ConvertFromString("#999999")),
|
||||||
HorizontalAlignment = HorizontalAlignment.Left,
|
HorizontalAlignment = HorizontalAlignment.Left,
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
VerticalAlignment = VerticalAlignment.Center,
|
||||||
TextAlignment = TextAlignment.Center,
|
Width = 200,
|
||||||
Width = 200
|
TextAlignment = TextAlignment.Center
|
||||||
};
|
});
|
||||||
grid.Children.Add(rankText);
|
|
||||||
|
|
||||||
var positionText = new TextBlock
|
// 名字
|
||||||
|
grid.Children.Add(new TextBlock
|
||||||
{
|
{
|
||||||
Text = item.Name,
|
Text = item.Name,
|
||||||
FontSize = 24,
|
FontSize = 24,
|
||||||
FontWeight = FontWeights.Bold,
|
FontWeight = FontWeights.Bold,
|
||||||
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#999999")),
|
Foreground = new SolidColorBrush(
|
||||||
|
(Color)ColorConverter.ConvertFromString("#999999")),
|
||||||
HorizontalAlignment = HorizontalAlignment.Center,
|
HorizontalAlignment = HorizontalAlignment.Center,
|
||||||
VerticalAlignment = VerticalAlignment.Center
|
VerticalAlignment = VerticalAlignment.Center
|
||||||
};
|
});
|
||||||
grid.Children.Add(positionText);
|
|
||||||
|
|
||||||
var scoreText = new TextBlock
|
// 分数
|
||||||
|
grid.Children.Add(new TextBlock
|
||||||
{
|
{
|
||||||
Text = item.Number.ToString(),
|
Text = item.Number.ToString(),
|
||||||
FontSize = 24,
|
FontSize = 24,
|
||||||
FontWeight = FontWeights.Bold,
|
FontWeight = FontWeights.Bold,
|
||||||
Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#999999")),
|
Foreground = new SolidColorBrush(
|
||||||
|
(Color)ColorConverter.ConvertFromString("#999999")),
|
||||||
HorizontalAlignment = HorizontalAlignment.Right,
|
HorizontalAlignment = HorizontalAlignment.Right,
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
VerticalAlignment = VerticalAlignment.Center,
|
||||||
TextAlignment = TextAlignment.Center,
|
Width = 200,
|
||||||
Width = 200
|
TextAlignment = TextAlignment.Center
|
||||||
};
|
});
|
||||||
grid.Children.Add(scoreText);
|
|
||||||
ScoreGrid.Children.Add(grid);
|
ScoreGrid.Children.Add(grid);
|
||||||
}
|
}
|
||||||
showElement("RankingGrid");
|
|
||||||
//var rankingGrid = FindName("RankingGrid") as Grid;
|
|
||||||
//if (rankingGrid == null) return;
|
|
||||||
|
|
||||||
//rankingGrid.Visibility = Visibility.Visible;
|
showElement("RankingGrid");
|
||||||
//var fadeIn = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(600));
|
|
||||||
//rankingGrid.BeginAnimation(UIElement.OpacityProperty, fadeIn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -152,6 +152,7 @@
|
|||||||
<None Remove="Resources\Music\musicjumprope.mp3" />
|
<None Remove="Resources\Music\musicjumprope.mp3" />
|
||||||
<None Remove="Resources\Music\musicjumprope1.mp3" />
|
<None Remove="Resources\Music\musicjumprope1.mp3" />
|
||||||
<None Remove="Resources\Music\raisehand.mp3" />
|
<None Remove="Resources\Music\raisehand.mp3" />
|
||||||
|
<None Remove="Resources\Music\whackamole.mp3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -648,6 +649,9 @@
|
|||||||
<Resource Include="Resources\Music\raisehand.mp3">
|
<Resource Include="Resources\Music\raisehand.mp3">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="Resources\Music\whackamole.mp3">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user