Add total earned/spent tracking

This commit is contained in:
Scott_NZ
2012-11-24 18:11:34 +13:00
parent 2a0b9a8596
commit 30a374b9e9
3 changed files with 43 additions and 5 deletions

View File

@@ -175,6 +175,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
.Where(a => a.Owner == player && !a.IsDead() && a.Info.Traits.WithInterface<ValuedInfo>().Any())
.Sum(a => a.Info.Traits.WithInterface<ValuedInfo>().First().Cost);
template.Get<LabelWidget>("TOTAL_EARNED").GetText = () => "$" + res.TotalEarned;
template.Get<LabelWidget>("TOTAL_SPENT").GetText = () => "$" + res.TotalSpent;
var numHarvesters = template.Get<LabelWidget>("NUMBER_HARVESTERS");
numHarvesters.GetText = () => world.Actors.Count(a => a.Owner == player && !a.IsDead() && a.HasTrait<Harvester>()).ToString();