Add more things to the Combat tab
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using OpenRA.Mods.RA.Buildings;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
@@ -22,6 +23,14 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
World world;
|
World world;
|
||||||
Player player;
|
Player player;
|
||||||
|
public double MapControl;
|
||||||
|
public int OrderCount;
|
||||||
|
public int KillsCost;
|
||||||
|
public int DeathsCost;
|
||||||
|
public int UnitsKilled;
|
||||||
|
public int UnitsDead;
|
||||||
|
public int BuildingsKilled;
|
||||||
|
public int BuildingsDead;
|
||||||
|
|
||||||
public PlayerStatistics(Actor self)
|
public PlayerStatistics(Actor self)
|
||||||
{
|
{
|
||||||
@@ -29,8 +38,6 @@ namespace OpenRA.Mods.RA
|
|||||||
player = self.Owner;
|
player = self.Owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double MapControl;
|
|
||||||
|
|
||||||
void UpdateMapControl()
|
void UpdateMapControl()
|
||||||
{
|
{
|
||||||
var total = (double)world.Map.Bounds.Width * world.Map.Bounds.Height;
|
var total = (double)world.Map.Bounds.Width * world.Map.Bounds.Height;
|
||||||
@@ -49,8 +56,6 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int OrderCount;
|
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
switch (order.OrderString)
|
switch (order.OrderString)
|
||||||
@@ -73,4 +78,31 @@ namespace OpenRA.Mods.RA
|
|||||||
OrderCount++;
|
OrderCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class UpdatesPlayerStatisticsInfo : TraitInfo<UpdatesPlayerStatistics> { }
|
||||||
|
|
||||||
|
public class UpdatesPlayerStatistics : INotifyKilled
|
||||||
|
{
|
||||||
|
public void Killed(Actor self, AttackInfo e)
|
||||||
|
{
|
||||||
|
var attackerStats = e.Attacker.Owner.PlayerActor.Trait<PlayerStatistics>();
|
||||||
|
var defenderStats = self.Owner.PlayerActor.Trait<PlayerStatistics>();
|
||||||
|
if (self.HasTrait<Building>())
|
||||||
|
{
|
||||||
|
attackerStats.BuildingsKilled++;
|
||||||
|
defenderStats.BuildingsDead++;
|
||||||
|
}
|
||||||
|
if (self.HasTrait<IMove>())
|
||||||
|
{
|
||||||
|
attackerStats.UnitsKilled++;
|
||||||
|
defenderStats.UnitsDead++;
|
||||||
|
}
|
||||||
|
if (self.HasTrait<Valued>())
|
||||||
|
{
|
||||||
|
var cost = self.Info.Traits.Get<ValuedInfo>().Cost;
|
||||||
|
attackerStats.KillsCost += cost;
|
||||||
|
defenderStats.DeathsCost += cost;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,6 +159,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
|
|
||||||
var stats = player.PlayerActor.Trait<PlayerStatistics>();
|
var stats = player.PlayerActor.Trait<PlayerStatistics>();
|
||||||
template.Get<LabelWidget>("CONTROL").GetText = () => MapControl(stats.MapControl);
|
template.Get<LabelWidget>("CONTROL").GetText = () => MapControl(stats.MapControl);
|
||||||
|
template.Get<LabelWidget>("KILLS_COST").GetText = () => "$" + stats.KillsCost.ToString();
|
||||||
|
template.Get<LabelWidget>("DEATHS_COST").GetText = () => "$" + stats.DeathsCost.ToString();
|
||||||
|
template.Get<LabelWidget>("UNITS_KILLED").GetText = () => stats.UnitsKilled.ToString();
|
||||||
|
template.Get<LabelWidget>("UNITS_DEAD").GetText = () => stats.UnitsDead.ToString();
|
||||||
|
template.Get<LabelWidget>("BUILDINGS_KILLED").GetText = () => stats.BuildingsKilled.ToString();
|
||||||
|
template.Get<LabelWidget>("BUILDINGS_DEAD").GetText = () => stats.BuildingsDead.ToString();
|
||||||
|
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ Container@OBSERVER_ROOT:
|
|||||||
Height:25
|
Height:25
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Text:Earned/min
|
Text:Earned/min
|
||||||
Label@POWER_HEADER
|
Label@POWER_HEADER:
|
||||||
X:425
|
X:425
|
||||||
Y:40
|
Y:40
|
||||||
Width:80
|
Width:80
|
||||||
@@ -503,28 +503,28 @@ Container@OBSERVER_ROOT:
|
|||||||
Height:25
|
Height:25
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Text:Earned/min
|
Text:Earned/min
|
||||||
Label@ASSETS_HEADER
|
Label@ASSETS_HEADER:
|
||||||
X:425
|
X:425
|
||||||
Y:40
|
Y:40
|
||||||
Width:60
|
Width:60
|
||||||
Height:25
|
Height:25
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Text:Assets
|
Text:Assets
|
||||||
Label@EARNED_HEADER
|
Label@EARNED_HEADER:
|
||||||
X:505
|
X:505
|
||||||
Y:40
|
Y:40
|
||||||
Width:60
|
Width:60
|
||||||
Height:25
|
Height:25
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Text:Earned
|
Text:Earned
|
||||||
Label@SPENT_HEADER
|
Label@SPENT_HEADER:
|
||||||
X:585
|
X:585
|
||||||
Y:40
|
Y:40
|
||||||
Width:60
|
Width:60
|
||||||
Height:25
|
Height:25
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Text:Spent
|
Text:Spent
|
||||||
Label@HARVESTERS_HEADER
|
Label@HARVESTERS_HEADER:
|
||||||
X:665
|
X:665
|
||||||
Y:40
|
Y:40
|
||||||
Width:60
|
Width:60
|
||||||
@@ -545,7 +545,7 @@ Container@OBSERVER_ROOT:
|
|||||||
Height:25
|
Height:25
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Text:Player
|
Text:Player
|
||||||
Label@PRODUCTION_HEADER
|
Label@PRODUCTION_HEADER:
|
||||||
X:245
|
X:245
|
||||||
Y:40
|
Y:40
|
||||||
Width:320
|
Width:320
|
||||||
@@ -579,6 +579,52 @@ Container@OBSERVER_ROOT:
|
|||||||
Height:25
|
Height:25
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Text:Control
|
Text:Control
|
||||||
|
Label@KILLS_COST_HEADER:
|
||||||
|
X:325
|
||||||
|
Y:40
|
||||||
|
Width:60
|
||||||
|
Height:25
|
||||||
|
Font:Bold
|
||||||
|
Text:Kills
|
||||||
|
Label@DEATHS_COST_HEADER:
|
||||||
|
X:405
|
||||||
|
Y:40
|
||||||
|
Width:60
|
||||||
|
Height:25
|
||||||
|
Font:Bold
|
||||||
|
Text:Deaths
|
||||||
|
Label@UNITS_KILLED_HEADER:
|
||||||
|
X:505
|
||||||
|
Y:40
|
||||||
|
Width:40
|
||||||
|
Height:25
|
||||||
|
Font:Bold
|
||||||
|
Text:Units Killed
|
||||||
|
Align:Right
|
||||||
|
Label@UNITS_DEAD_HEADER:
|
||||||
|
X:605
|
||||||
|
Y:40
|
||||||
|
Width:40
|
||||||
|
Height:25
|
||||||
|
Font:Bold
|
||||||
|
Text:Units Dead
|
||||||
|
Align:Right
|
||||||
|
Label@BUILDINGS_KILLED_HEADER:
|
||||||
|
X:725
|
||||||
|
Y:40
|
||||||
|
Width:40
|
||||||
|
Height:25
|
||||||
|
Font:Bold
|
||||||
|
Text:Bld Destroyed
|
||||||
|
Align:Right
|
||||||
|
Label@BUILDINGS_DEAD_HEADER:
|
||||||
|
X:825
|
||||||
|
Y:40
|
||||||
|
Width:40
|
||||||
|
Height:25
|
||||||
|
Font:Bold
|
||||||
|
Text:Bld Lost
|
||||||
|
Align:Right
|
||||||
ScrollPanel@PLAYER_STATS_PANEL:
|
ScrollPanel@PLAYER_STATS_PANEL:
|
||||||
X:25
|
X:25
|
||||||
Y:70
|
Y:70
|
||||||
@@ -748,11 +794,45 @@ Container@OBSERVER_ROOT:
|
|||||||
Width:160
|
Width:160
|
||||||
Height:PARENT_BOTTOM
|
Height:PARENT_BOTTOM
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Label@CONTROL
|
Label@CONTROL:
|
||||||
X:215
|
X:215
|
||||||
Y:0
|
Y:0
|
||||||
Width:60
|
Width:60
|
||||||
Height:PARENT_BOTTOM
|
Height:PARENT_BOTTOM
|
||||||
|
Label@KILLS_COST:
|
||||||
|
X:295
|
||||||
|
Y:0
|
||||||
|
Width:60
|
||||||
|
Height:PARENT_BOTTOM
|
||||||
|
Label@DEATHS_COST:
|
||||||
|
X:375
|
||||||
|
Y:0
|
||||||
|
Width:60
|
||||||
|
Height:PARENT_BOTTOM
|
||||||
|
Label@UNITS_KILLED:
|
||||||
|
X:475
|
||||||
|
Y:0
|
||||||
|
Width:40
|
||||||
|
Height:PARENT_BOTTOM
|
||||||
|
Align:Right
|
||||||
|
Label@UNITS_DEAD:
|
||||||
|
X:575
|
||||||
|
Y:0
|
||||||
|
Width:40
|
||||||
|
Height:PARENT_BOTTOM
|
||||||
|
Align:Right
|
||||||
|
Label@BUILDINGS_KILLED:
|
||||||
|
X:695
|
||||||
|
Y:0
|
||||||
|
Width:40
|
||||||
|
Height:PARENT_BOTTOM
|
||||||
|
Align:Right
|
||||||
|
Label@BUILDINGS_DEAD:
|
||||||
|
X:795
|
||||||
|
Y:0
|
||||||
|
Width:40
|
||||||
|
Height:PARENT_BOTTOM
|
||||||
|
Align:Right
|
||||||
Background@FMVPLAYER:
|
Background@FMVPLAYER:
|
||||||
Width:WINDOW_RIGHT
|
Width:WINDOW_RIGHT
|
||||||
Height:WINDOW_BOTTOM
|
Height:WINDOW_BOTTOM
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
GpsDot:
|
GpsDot:
|
||||||
String:Vehicle
|
String:Vehicle
|
||||||
WithSmoke:
|
WithSmoke:
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
|
||||||
^Tank:
|
^Tank:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
@@ -67,6 +68,7 @@
|
|||||||
GpsDot:
|
GpsDot:
|
||||||
String:Vehicle
|
String:Vehicle
|
||||||
WithSmoke:
|
WithSmoke:
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
|
||||||
^Infantry:
|
^Infantry:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
@@ -114,6 +116,7 @@
|
|||||||
RepairableNear:
|
RepairableNear:
|
||||||
Buildings: hosp
|
Buildings: hosp
|
||||||
CloseEnough: 1
|
CloseEnough: 1
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
|
||||||
^Ship:
|
^Ship:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
@@ -141,6 +144,7 @@
|
|||||||
GpsDot:
|
GpsDot:
|
||||||
String:Ship
|
String:Ship
|
||||||
WithSmoke:
|
WithSmoke:
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
|
||||||
^Plane:
|
^Plane:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
@@ -169,6 +173,7 @@
|
|||||||
GivesBounty:
|
GivesBounty:
|
||||||
GpsDot:
|
GpsDot:
|
||||||
String:Plane
|
String:Plane
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
|
||||||
^Helicopter:
|
^Helicopter:
|
||||||
Inherits: ^Plane
|
Inherits: ^Plane
|
||||||
@@ -210,6 +215,7 @@
|
|||||||
Sellable:
|
Sellable:
|
||||||
AcceptsSupplies:
|
AcceptsSupplies:
|
||||||
GivesBounty:
|
GivesBounty:
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
|
||||||
^Wall:
|
^Wall:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
@@ -242,6 +248,7 @@
|
|||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types:Wall
|
Types:Wall
|
||||||
Sellable:
|
Sellable:
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
|
||||||
^TechBuilding:
|
^TechBuilding:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
|
|||||||
Reference in New Issue
Block a user