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();
}
}
}

View File

@@ -34,6 +34,7 @@
Guard:
Guardable:
BodyOrientation:
UpdatesPlayerStatistics:
^Tank:
AppearsOnRadar:
@@ -74,6 +75,7 @@
Guard:
Guardable:
BodyOrientation:
UpdatesPlayerStatistics:
^Helicopter:
AppearsOnRadar:
@@ -100,6 +102,7 @@
EmptyWeapon: HeliExplode
DebugMuzzlePositions:
BodyOrientation:
UpdatesPlayerStatistics:
^Infantry:
AppearsOnRadar:
@@ -156,6 +159,7 @@
HealIfBelow: 1
DamageCooldown: 125
RequiresTech: InfantryHealing
UpdatesPlayerStatistics:
^CivInfantry:
Inherits: ^Infantry
@@ -232,6 +236,7 @@
ScanRadius: 4
AttackMove:
AttackFrontal:
UpdatesPlayerStatistics:
^Plane:
AppearsOnRadar:
@@ -270,6 +275,7 @@
Guard:
Guardable:
BodyOrientation:
UpdatesPlayerStatistics:
^Building:
AppearsOnRadar:
@@ -318,6 +324,7 @@
Range: 3
BodyOrientation:
FrozenUnderFog:
UpdatesPlayerStatistics:
^CivBuilding:
Inherits: ^Building

View File

@@ -202,6 +202,7 @@ Player:
RemapIndex: 176, 178, 180, 182, 184, 186, 189, 191, 177, 179, 181, 183, 185, 187, 188, 190
BaseAttackNotifier:
Shroud:
PlayerStatistics:
World:
LoadWidgetAtGameStart: