Refactored GraphWidget to LineGraphWidget

This commit is contained in:
Scott_NZ
2012-11-28 01:52:48 +13:00
parent a78f8865b8
commit 4c729ca5ed
4 changed files with 49 additions and 30 deletions

View File

@@ -151,8 +151,13 @@ namespace OpenRA.Mods.RA.Widgets.Logic
earnedThisMinuteGraphHeaders.Visible = true;
var template = earnedThisMinuteGraphTemplate.Clone();
var graph = template.Get<GraphWidget>("EARNED_THIS_MIN_GRAPH");
graph.GetDataSource = () => players.Select(p => Pair.New(p, p.PlayerActor.Trait<PlayerStatistics>().EarnedSamples.Select(s => (float)s)));
var graph = template.Get<LineGraphWidget>("EARNED_THIS_MIN_GRAPH");
graph.GetSeries = () =>
players.Select(p => new LineGraphSeries(
p.PlayerName,
p.ColorRamp.GetColor(0),
p.PlayerActor.Trait<PlayerStatistics>().EarnedSamples.Select(s => (float)s)
));
playerStatsPanel.AddChild(template);
}