use advanced player statistics in cnc mod

This commit is contained in:
Matthias Mailänder
2013-08-10 11:41:28 +02:00
parent 119f9b9ff0
commit 771c32255c
3 changed files with 16 additions and 2 deletions

View File

@@ -10,6 +10,7 @@
using System.Drawing;
using System.Linq;
using OpenRA.Mods.RA;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets.Logic
@@ -60,8 +61,13 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
team.GetText = () => (pp.PlayerReference.Team == 0) ? "-" : pp.PlayerReference.Team.ToString();
scrollpanel.AddChild(item);
item.Get<LabelWidget>("KILLS").GetText = () => pp.Kills.ToString();
item.Get<LabelWidget>("DEATHS").GetText = () => pp.Deaths.ToString();
var stats = pp.PlayerActor.TraitOrDefault<PlayerStatistics>();
if (stats == null)
break;
var totalKills = stats.UnitsKilled + stats.BuildingsKilled;
var totalDeaths = stats.UnitsDead + stats.BuildingsDead;
item.Get<LabelWidget>("KILLS").GetText = () => totalKills.ToString();
item.Get<LabelWidget>("DEATHS").GetText = () => totalDeaths.ToString();
}
}
}