public void Fetch(IEnumerable <PlayerInfo> playerStatsSequence) { var formatHelpers = FormatHelpers.Pretty; playerStatsSequence = playerStatsSequence.OrderByDescending(playerStats => playerStats.Dealt.Damage + playerStats.Dealt.Heal); TotalDamageLabel.Text = string.Format("Total damage: {0}", formatHelpers.FormatValue(_damageTracker.TotalDealt.Damage)); TotalTimeLabel.Text = string.Format("Total time: {0}", formatHelpers.FormatTimeSpan(_damageTracker.Duration) ?? "-"); TotalDpsLabel.Text = string.Format("Total DPS: {0}/s", formatHelpers.FormatValue(_damageTracker.Dps(_damageTracker.TotalDealt.Damage)) ?? "-"); TotalDpsLabel.Left = FooterPanel.Width - TotalDpsLabel.Width; TotalTimeLabel.Left = FooterPanel.Width - TotalTimeLabel.Width; int pos = 0; var visiblePlayerStats = new HashSet <PlayerInfo>(); foreach (var playerStats in playerStatsSequence) { if (pos > ListPanel.Height) { break; } visiblePlayerStats.Add(playerStats); PlayerStatsControl playerStatsControl; _controls.TryGetValue(playerStats, out playerStatsControl); if (playerStatsControl == null) { playerStatsControl = new PlayerStatsControl(); playerStatsControl.PlayerInfo = playerStats; playerStatsControl.Height = 50; _controls.Add(playerStats, playerStatsControl); playerStatsControl.Parent = ListPanel; playerStatsControl.ClassIcons = _classIcons; } playerStatsControl.Top = pos; playerStatsControl.Width = ListPanel.Width; pos += playerStatsControl.Height + 2; _toolTip.SetToolTip(playerStatsControl, playerStats.FullName); playerStatsControl.Invalidate(); } var invisibleControls = _controls.Where(x => !visiblePlayerStats.Contains(x.Key)).ToList(); foreach (var invisibleControl in invisibleControls) { invisibleControl.Value.Dispose(); _controls.Remove(invisibleControl.Key); } }
public void Fetch(IEnumerable <PlayerInfo> playerStatsSequence) { playerStatsSequence = playerStatsSequence.OrderByDescending(playerStats => playerStats.Dealt.Damage + playerStats.Dealt.Heal); var totalDamage = playerStatsSequence.Sum(playerStats => playerStats.Dealt.Damage); TotalDamageLabel.Text = FormatHelpers.FormatValue(totalDamage); TotalDamageLabel.Left = HeaderPanel.Width - TotalDamageLabel.Width; int pos = 0; var visiblePlayerStats = new HashSet <PlayerInfo>(); foreach (var playerStats in playerStatsSequence) { if (pos > ListPanel.Height) { break; } visiblePlayerStats.Add(playerStats); PlayerStatsControl playerStatsControl; _controls.TryGetValue(playerStats, out playerStatsControl); if (playerStatsControl == null) { playerStatsControl = new PlayerStatsControl(); playerStatsControl.PlayerInfo = playerStats; playerStatsControl.Height = 40; _controls.Add(playerStats, playerStatsControl); playerStatsControl.Parent = ListPanel; playerStatsControl.ClassIcons = _classIcons; } playerStatsControl.Top = pos; playerStatsControl.Width = ListPanel.Width; pos += playerStatsControl.Height + 2; playerStatsControl.TotalDamage = totalDamage; playerStatsControl.Invalidate(); } var invisibleControls = _controls.Where(x => !visiblePlayerStats.Contains(x.Key)).ToList(); foreach (var invisibleControl in invisibleControls) { invisibleControl.Value.Dispose(); _controls.Remove(invisibleControl.Key); } }
public void Fetch(IEnumerable<PlayerInfo> playerStatsSequence) { playerStatsSequence = playerStatsSequence.OrderByDescending(playerStats => playerStats.Dealt.Damage + playerStats.Dealt.Heal); var totalDamage = playerStatsSequence.Sum(playerStats => playerStats.Dealt.Damage); TotalDamageLabel.Text = Helpers.FormatValue(totalDamage); TotalDamageLabel.Left = HeaderPanel.Width - TotalDamageLabel.Width; var pos = 0; var visiblePlayerStats = new HashSet<PlayerInfo>(); foreach (var playerStats in playerStatsSequence) { Console.WriteLine("has data"); Console.WriteLine("totalDamage" + totalDamage); if (pos > ListPanel.Height) break; visiblePlayerStats.Add(playerStats); PlayerStatsControl playerStatsControl; _controls.TryGetValue(playerStats, out playerStatsControl); if (playerStatsControl == null) { playerStatsControl = new PlayerStatsControl(); playerStatsControl.PlayerInfo = playerStats; Console.WriteLine(playerStats); playerStatsControl.Height = 40; _controls.Add(playerStats, playerStatsControl); playerStatsControl.Parent = ListPanel; playerStatsControl.ClassIcons = _classIcons; } playerStatsControl.Top = pos; playerStatsControl.Width = ListPanel.Width; pos += playerStatsControl.Height + 2; playerStatsControl.TotalDamage = totalDamage; playerStatsControl.Invalidate(); } var invisibleControls = _controls.Where(x => !visiblePlayerStats.Contains(x.Key)).ToList(); foreach (var invisibleControl in invisibleControls) { invisibleControl.Value.Dispose(); _controls.Remove(invisibleControl.Key); } }
public void Fetch(IEnumerable<PlayerInfo> playerStatsSequence) { var formatHelpers = FormatHelpers.Pretty; playerStatsSequence = playerStatsSequence.OrderByDescending(playerStats => playerStats.Dealt.Damage + playerStats.Dealt.Heal); TotalDamageLabel.Text = string.Format("Total damage: {0}", formatHelpers.FormatValue(_damageTracker.TotalDealt.Damage)); TotalTimeLabel.Text = string.Format("Total time: {0}", formatHelpers.FormatTimeSpan(_damageTracker.Duration) ?? "-"); TotalDpsLabel.Text = string.Format("Total DPS: {0}/s", formatHelpers.FormatValue(_damageTracker.Dps(_damageTracker.TotalDealt.Damage)) ?? "-"); TotalDpsLabel.Left = FooterPanel.Width - TotalDpsLabel.Width; TotalTimeLabel.Left = FooterPanel.Width - TotalTimeLabel.Width; int pos = 0; var visiblePlayerStats = new HashSet<PlayerInfo>(); foreach (var playerStats in playerStatsSequence) { if (pos > ListPanel.Height) break; visiblePlayerStats.Add(playerStats); PlayerStatsControl playerStatsControl; _controls.TryGetValue(playerStats, out playerStatsControl); if (playerStatsControl == null) { playerStatsControl = new PlayerStatsControl(); playerStatsControl.PlayerInfo = playerStats; playerStatsControl.Height = 50; _controls.Add(playerStats, playerStatsControl); playerStatsControl.Parent = ListPanel; playerStatsControl.ClassIcons = _classIcons; } playerStatsControl.Top = pos; playerStatsControl.Width = ListPanel.Width; pos += playerStatsControl.Height + 2; playerStatsControl.Invalidate(); } var invisibleControls = _controls.Where(x => !visiblePlayerStats.Contains(x.Key)).ToList(); foreach (var invisibleControl in invisibleControls) { invisibleControl.Value.Dispose(); _controls.Remove(invisibleControl.Key); } }