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.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Mods.RA;
using OpenRA.Widgets; using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets.Logic 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(); team.GetText = () => (pp.PlayerReference.Team == 0) ? "-" : pp.PlayerReference.Team.ToString();
scrollpanel.AddChild(item); scrollpanel.AddChild(item);
item.Get<LabelWidget>("KILLS").GetText = () => pp.Kills.ToString(); var stats = pp.PlayerActor.TraitOrDefault<PlayerStatistics>();
item.Get<LabelWidget>("DEATHS").GetText = () => pp.Deaths.ToString(); 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: Guard:
Guardable: Guardable:
BodyOrientation: BodyOrientation:
UpdatesPlayerStatistics:
^Tank: ^Tank:
AppearsOnRadar: AppearsOnRadar:
@@ -74,6 +75,7 @@
Guard: Guard:
Guardable: Guardable:
BodyOrientation: BodyOrientation:
UpdatesPlayerStatistics:
^Helicopter: ^Helicopter:
AppearsOnRadar: AppearsOnRadar:
@@ -100,6 +102,7 @@
EmptyWeapon: HeliExplode EmptyWeapon: HeliExplode
DebugMuzzlePositions: DebugMuzzlePositions:
BodyOrientation: BodyOrientation:
UpdatesPlayerStatistics:
^Infantry: ^Infantry:
AppearsOnRadar: AppearsOnRadar:
@@ -156,6 +159,7 @@
HealIfBelow: 1 HealIfBelow: 1
DamageCooldown: 125 DamageCooldown: 125
RequiresTech: InfantryHealing RequiresTech: InfantryHealing
UpdatesPlayerStatistics:
^CivInfantry: ^CivInfantry:
Inherits: ^Infantry Inherits: ^Infantry
@@ -232,6 +236,7 @@
ScanRadius: 4 ScanRadius: 4
AttackMove: AttackMove:
AttackFrontal: AttackFrontal:
UpdatesPlayerStatistics:
^Plane: ^Plane:
AppearsOnRadar: AppearsOnRadar:
@@ -270,6 +275,7 @@
Guard: Guard:
Guardable: Guardable:
BodyOrientation: BodyOrientation:
UpdatesPlayerStatistics:
^Building: ^Building:
AppearsOnRadar: AppearsOnRadar:
@@ -318,6 +324,7 @@
Range: 3 Range: 3
BodyOrientation: BodyOrientation:
FrozenUnderFog: FrozenUnderFog:
UpdatesPlayerStatistics:
^CivBuilding: ^CivBuilding:
Inherits: ^Building 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 RemapIndex: 176, 178, 180, 182, 184, 186, 189, 191, 177, 179, 181, 183, 185, 187, 188, 190
BaseAttackNotifier: BaseAttackNotifier:
Shroud: Shroud:
PlayerStatistics:
World: World:
LoadWidgetAtGameStart: LoadWidgetAtGameStart: