Added widget showing the army for players in spec
This commit is contained in:
@@ -10,7 +10,11 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRA;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Mods.Common.Traits.Render;
|
||||||
|
using OpenRA.Primitives;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
@@ -64,8 +68,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
bool armyGraphDisabled;
|
bool armyGraphDisabled;
|
||||||
bool incomeGraphDisabled;
|
bool incomeGraphDisabled;
|
||||||
|
public readonly Cache<string, ArmyUnit> Units;
|
||||||
|
|
||||||
public PlayerStatistics(Actor self) { }
|
public PlayerStatistics(Actor self)
|
||||||
|
{
|
||||||
|
Units = new Cache<string, ArmyUnit>(name => new ArmyUnit(self.World.Map.Rules.Actors[name], self.Owner));
|
||||||
|
}
|
||||||
|
|
||||||
void INotifyCreated.Created(Actor self)
|
void INotifyCreated.Created(Actor self)
|
||||||
{
|
{
|
||||||
@@ -151,28 +159,74 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ArmyUnit
|
||||||
|
{
|
||||||
|
public readonly ActorInfo ActorInfo;
|
||||||
|
public readonly Animation Icon;
|
||||||
|
public readonly string IconPalette;
|
||||||
|
public readonly int ProductionQueueOrder;
|
||||||
|
public readonly int BuildPaletteOrder;
|
||||||
|
public readonly TooltipInfo TooltipInfo;
|
||||||
|
public readonly BuildableInfo BuildableInfo;
|
||||||
|
|
||||||
|
public int Count { get; set; }
|
||||||
|
|
||||||
|
public ArmyUnit(ActorInfo actorInfo, Player owner)
|
||||||
|
{
|
||||||
|
ActorInfo = actorInfo;
|
||||||
|
|
||||||
|
var queues = owner.World.Map.Rules.Actors.Values
|
||||||
|
.SelectMany(a => a.TraitInfos<ProductionQueueInfo>());
|
||||||
|
|
||||||
|
BuildableInfo = actorInfo.TraitInfoOrDefault<BuildableInfo>();
|
||||||
|
TooltipInfo = actorInfo.TraitInfos<TooltipInfo>().FirstOrDefault(info => info.EnabledByDefault);
|
||||||
|
|
||||||
|
ProductionQueueOrder = queues.Where(q => BuildableInfo.Queue.Contains(q.Type))
|
||||||
|
.Select(q => q.DisplayOrder)
|
||||||
|
.MinByOrDefault(o => o);
|
||||||
|
|
||||||
|
var rsi = actorInfo.TraitInfoOrDefault<RenderSpritesInfo>();
|
||||||
|
|
||||||
|
if (BuildableInfo != null && rsi != null)
|
||||||
|
{
|
||||||
|
var image = rsi.GetImage(actorInfo, owner.World.Map.Rules.Sequences, owner.Faction.Name);
|
||||||
|
Icon = new Animation(owner.World, image);
|
||||||
|
Icon.Play(BuildableInfo.Icon);
|
||||||
|
IconPalette = BuildableInfo.IconPalette;
|
||||||
|
BuildPaletteOrder = BuildableInfo.BuildPaletteOrder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Desc("Attach this to a unit to update observer stats.")]
|
[Desc("Attach this to a unit to update observer stats.")]
|
||||||
public class UpdatesPlayerStatisticsInfo : ITraitInfo
|
public class UpdatesPlayerStatisticsInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Add to army value in statistics")]
|
[Desc("Add to army value in statistics")]
|
||||||
public bool AddToArmyValue = false;
|
public bool AddToArmyValue = false;
|
||||||
|
|
||||||
|
[ActorReference]
|
||||||
|
[Desc("Count this actor as a different type in the spectator army display.")]
|
||||||
|
public string OverrideActor = null;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new UpdatesPlayerStatistics(this, init.Self); }
|
public object Create(ActorInitializer init) { return new UpdatesPlayerStatistics(this, init.Self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdatesPlayerStatistics : INotifyKilled, INotifyCreated, INotifyOwnerChanged, INotifyActorDisposing
|
public class UpdatesPlayerStatistics : INotifyKilled, INotifyCreated, INotifyOwnerChanged, INotifyActorDisposing
|
||||||
{
|
{
|
||||||
UpdatesPlayerStatisticsInfo info;
|
readonly UpdatesPlayerStatisticsInfo info;
|
||||||
|
readonly string actorName;
|
||||||
|
readonly int cost = 0;
|
||||||
|
|
||||||
PlayerStatistics playerStats;
|
PlayerStatistics playerStats;
|
||||||
int cost = 0;
|
|
||||||
bool includedInArmyValue = false;
|
bool includedInArmyValue = false;
|
||||||
|
|
||||||
public UpdatesPlayerStatistics(UpdatesPlayerStatisticsInfo info, Actor self)
|
public UpdatesPlayerStatistics(UpdatesPlayerStatisticsInfo info, Actor self)
|
||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
if (self.Info.HasTraitInfo<ValuedInfo>())
|
var valuedInfo = self.Info.TraitInfoOrDefault<ValuedInfo>();
|
||||||
cost = self.Info.TraitInfo<ValuedInfo>().Cost;
|
cost = valuedInfo != null ? valuedInfo.Cost : 0;
|
||||||
playerStats = self.Owner.PlayerActor.Trait<PlayerStatistics>();
|
playerStats = self.Owner.PlayerActor.Trait<PlayerStatistics>();
|
||||||
|
actorName = info.OverrideActor ?? self.Info.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void INotifyKilled.Killed(Actor self, AttackInfo e)
|
void INotifyKilled.Killed(Actor self, AttackInfo e)
|
||||||
@@ -199,14 +253,19 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
defenderStats.ArmyValue -= cost;
|
defenderStats.ArmyValue -= cost;
|
||||||
includedInArmyValue = false;
|
includedInArmyValue = false;
|
||||||
|
playerStats.Units[actorName].Count--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void INotifyCreated.Created(Actor self)
|
void INotifyCreated.Created(Actor self)
|
||||||
{
|
{
|
||||||
includedInArmyValue = info.AddToArmyValue;
|
includedInArmyValue = info.AddToArmyValue;
|
||||||
|
|
||||||
if (includedInArmyValue)
|
if (includedInArmyValue)
|
||||||
|
{
|
||||||
playerStats.ArmyValue += cost;
|
playerStats.ArmyValue += cost;
|
||||||
|
playerStats.Units[actorName].Count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
||||||
@@ -216,6 +275,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
playerStats.ArmyValue -= cost;
|
playerStats.ArmyValue -= cost;
|
||||||
newOwnerStats.ArmyValue += cost;
|
newOwnerStats.ArmyValue += cost;
|
||||||
|
playerStats.Units[actorName].Count--;
|
||||||
|
newOwnerStats.Units[actorName].Count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
playerStats = newOwnerStats;
|
playerStats = newOwnerStats;
|
||||||
@@ -227,6 +288,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
playerStats.ArmyValue -= cost;
|
playerStats.ArmyValue -= cost;
|
||||||
includedInArmyValue = false;
|
includedInArmyValue = false;
|
||||||
|
playerStats.Units[actorName].Count--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
67
OpenRA.Mods.Common/Widgets/Logic/Ingame/ArmyTooltipLogic.cs
Normal file
67
OpenRA.Mods.Common/Widgets/Logic/Ingame/ArmyTooltipLogic.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation, either version 3 of
|
||||||
|
* the License, or (at your option) any later version. For more
|
||||||
|
* information, see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRA.Mods.Common.Traits;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||||
|
{
|
||||||
|
public class ArmyTooltipLogic : ChromeLogic
|
||||||
|
{
|
||||||
|
[ObjectCreator.UseCtor]
|
||||||
|
public ArmyTooltipLogic(Widget widget, TooltipContainerWidget tooltipContainer, Func<ArmyUnit> getTooltipUnit)
|
||||||
|
{
|
||||||
|
widget.IsVisible = () => getTooltipUnit() != null;
|
||||||
|
var nameLabel = widget.Get<LabelWidget>("NAME");
|
||||||
|
var descLabel = widget.Get<LabelWidget>("DESC");
|
||||||
|
|
||||||
|
var font = Game.Renderer.Fonts[nameLabel.Font];
|
||||||
|
var descFont = Game.Renderer.Fonts[descLabel.Font];
|
||||||
|
|
||||||
|
ArmyUnit lastArmyUnit = null;
|
||||||
|
var descLabelPadding = descLabel.Bounds.Height;
|
||||||
|
|
||||||
|
tooltipContainer.BeforeRender = () =>
|
||||||
|
{
|
||||||
|
var armyUnit = getTooltipUnit();
|
||||||
|
|
||||||
|
if (armyUnit == null || armyUnit == lastArmyUnit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var tooltip = armyUnit.TooltipInfo;
|
||||||
|
var name = tooltip != null ? tooltip.Name : armyUnit.ActorInfo.Name;
|
||||||
|
var buildable = armyUnit.BuildableInfo;
|
||||||
|
|
||||||
|
nameLabel.Text = name;
|
||||||
|
|
||||||
|
var nameSize = font.Measure(name);
|
||||||
|
|
||||||
|
descLabel.Text = buildable.Description.Replace("\\n", "\n");
|
||||||
|
var descSize = descFont.Measure(descLabel.Text);
|
||||||
|
descLabel.Bounds.Width = descSize.X;
|
||||||
|
descLabel.Bounds.Height = descSize.Y + descLabelPadding;
|
||||||
|
|
||||||
|
var leftWidth = Math.Max(nameSize.X, descSize.X);
|
||||||
|
|
||||||
|
widget.Bounds.Width = leftWidth + 2 * nameLabel.Bounds.X;
|
||||||
|
|
||||||
|
// Set the bottom margin to match the left margin
|
||||||
|
var leftHeight = descLabel.Bounds.Bottom + descLabel.Bounds.X;
|
||||||
|
|
||||||
|
widget.Bounds.Height = leftHeight;
|
||||||
|
|
||||||
|
lastArmyUnit = armyUnit;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,9 +21,9 @@ using OpenRA.Widgets;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Widgets.Logic
|
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||||
{
|
{
|
||||||
public enum ObserverStatsPanel { None, Basic, Economy, Production, SupportPowers, Combat, Graph, ArmyGraph }
|
public enum ObserverStatsPanel { None, Basic, Economy, Production, SupportPowers, Combat, Army, Graph, ArmyGraph }
|
||||||
|
|
||||||
[ChromeLogicArgsHotkeys("StatisticsBasicKey", "StatisticsEconomyKey", "StatisticsProductionKey", "StatisticsSupportPowersKey", "StatisticsCombatKey", "StatisticsGraphKey",
|
[ChromeLogicArgsHotkeys("StatisticsBasicKey", "StatisticsEconomyKey", "StatisticsProductionKey", "StatisticsSupportPowersKey", "StatisticsCombatKey", "StatisticsArmyKey", "StatisticsGraphKey",
|
||||||
"StatisticsArmyGraphKey")]
|
"StatisticsArmyGraphKey")]
|
||||||
public class ObserverStatsLogic : ChromeLogic
|
public class ObserverStatsLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
@@ -32,11 +32,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly ContainerWidget productionStatsHeaders;
|
readonly ContainerWidget productionStatsHeaders;
|
||||||
readonly ContainerWidget supportPowerStatsHeaders;
|
readonly ContainerWidget supportPowerStatsHeaders;
|
||||||
readonly ContainerWidget combatStatsHeaders;
|
readonly ContainerWidget combatStatsHeaders;
|
||||||
|
readonly ContainerWidget armyHeaders;
|
||||||
readonly ScrollPanelWidget playerStatsPanel;
|
readonly ScrollPanelWidget playerStatsPanel;
|
||||||
readonly ScrollItemWidget basicPlayerTemplate;
|
readonly ScrollItemWidget basicPlayerTemplate;
|
||||||
readonly ScrollItemWidget economyPlayerTemplate;
|
readonly ScrollItemWidget economyPlayerTemplate;
|
||||||
readonly ScrollItemWidget productionPlayerTemplate;
|
readonly ScrollItemWidget productionPlayerTemplate;
|
||||||
readonly ScrollItemWidget supportPowersPlayerTemplate;
|
readonly ScrollItemWidget supportPowersPlayerTemplate;
|
||||||
|
readonly ScrollItemWidget armyPlayerTemplate;
|
||||||
readonly ScrollItemWidget combatPlayerTemplate;
|
readonly ScrollItemWidget combatPlayerTemplate;
|
||||||
readonly ContainerWidget incomeGraphContainer;
|
readonly ContainerWidget incomeGraphContainer;
|
||||||
readonly ContainerWidget armyValueGraphContainer;
|
readonly ContainerWidget armyValueGraphContainer;
|
||||||
@@ -72,6 +74,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
economyStatsHeaders = widget.Get<ContainerWidget>("ECONOMY_STATS_HEADERS");
|
economyStatsHeaders = widget.Get<ContainerWidget>("ECONOMY_STATS_HEADERS");
|
||||||
productionStatsHeaders = widget.Get<ContainerWidget>("PRODUCTION_STATS_HEADERS");
|
productionStatsHeaders = widget.Get<ContainerWidget>("PRODUCTION_STATS_HEADERS");
|
||||||
supportPowerStatsHeaders = widget.Get<ContainerWidget>("SUPPORT_POWERS_HEADERS");
|
supportPowerStatsHeaders = widget.Get<ContainerWidget>("SUPPORT_POWERS_HEADERS");
|
||||||
|
armyHeaders = widget.Get<ContainerWidget>("ARMY_HEADERS");
|
||||||
combatStatsHeaders = widget.Get<ContainerWidget>("COMBAT_STATS_HEADERS");
|
combatStatsHeaders = widget.Get<ContainerWidget>("COMBAT_STATS_HEADERS");
|
||||||
|
|
||||||
playerStatsPanel = widget.Get<ScrollPanelWidget>("PLAYER_STATS_PANEL");
|
playerStatsPanel = widget.Get<ScrollPanelWidget>("PLAYER_STATS_PANEL");
|
||||||
@@ -87,12 +90,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
AdjustHeader(productionStatsHeaders);
|
AdjustHeader(productionStatsHeaders);
|
||||||
AdjustHeader(supportPowerStatsHeaders);
|
AdjustHeader(supportPowerStatsHeaders);
|
||||||
AdjustHeader(combatStatsHeaders);
|
AdjustHeader(combatStatsHeaders);
|
||||||
|
AdjustHeader(armyHeaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
basicPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("BASIC_PLAYER_TEMPLATE");
|
basicPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("BASIC_PLAYER_TEMPLATE");
|
||||||
economyPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("ECONOMY_PLAYER_TEMPLATE");
|
economyPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("ECONOMY_PLAYER_TEMPLATE");
|
||||||
productionPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("PRODUCTION_PLAYER_TEMPLATE");
|
productionPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("PRODUCTION_PLAYER_TEMPLATE");
|
||||||
supportPowersPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("SUPPORT_POWERS_PLAYER_TEMPLATE");
|
supportPowersPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("SUPPORT_POWERS_PLAYER_TEMPLATE");
|
||||||
|
armyPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("ARMY_PLAYER_TEMPLATE");
|
||||||
combatPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("COMBAT_PLAYER_TEMPLATE");
|
combatPlayerTemplate = playerStatsPanel.Get<ScrollItemWidget>("COMBAT_PLAYER_TEMPLATE");
|
||||||
|
|
||||||
incomeGraphContainer = widget.Get<ContainerWidget>("INCOME_GRAPH_CONTAINER");
|
incomeGraphContainer = widget.Get<ContainerWidget>("INCOME_GRAPH_CONTAINER");
|
||||||
@@ -144,6 +149,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
createStatsOption("Production", ObserverStatsPanel.Production, productionPlayerTemplate, () => DisplayStats(ProductionStats)),
|
createStatsOption("Production", ObserverStatsPanel.Production, productionPlayerTemplate, () => DisplayStats(ProductionStats)),
|
||||||
createStatsOption("Support Powers", ObserverStatsPanel.SupportPowers, supportPowersPlayerTemplate, () => DisplayStats(SupportPowerStats)),
|
createStatsOption("Support Powers", ObserverStatsPanel.SupportPowers, supportPowersPlayerTemplate, () => DisplayStats(SupportPowerStats)),
|
||||||
createStatsOption("Combat", ObserverStatsPanel.Combat, combatPlayerTemplate, () => DisplayStats(CombatStats)),
|
createStatsOption("Combat", ObserverStatsPanel.Combat, combatPlayerTemplate, () => DisplayStats(CombatStats)),
|
||||||
|
createStatsOption("Army", ObserverStatsPanel.Army, armyPlayerTemplate, () => DisplayStats(ArmyStats)),
|
||||||
createStatsOption("Earnings (graph)", ObserverStatsPanel.Graph, null, () => IncomeGraph()),
|
createStatsOption("Earnings (graph)", ObserverStatsPanel.Graph, null, () => IncomeGraph()),
|
||||||
createStatsOption("Army (graph)", ObserverStatsPanel.ArmyGraph, null, () => ArmyValueGraph()),
|
createStatsOption("Army (graph)", ObserverStatsPanel.ArmyGraph, null, () => ArmyValueGraph()),
|
||||||
};
|
};
|
||||||
@@ -157,7 +163,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var statsDropDownPanelTemplate = logicArgs.TryGetValue("StatsDropDownPanelTemplate", out yaml) ? yaml.Value : "LABEL_DROPDOWN_TEMPLATE";
|
var statsDropDownPanelTemplate = logicArgs.TryGetValue("StatsDropDownPanelTemplate", out yaml) ? yaml.Value : "LABEL_DROPDOWN_TEMPLATE";
|
||||||
|
|
||||||
statsDropDown.OnMouseDown = _ => statsDropDown.ShowDropDown(statsDropDownPanelTemplate, 205, statsDropDownOptions, setupItem);
|
statsDropDown.OnMouseDown = _ => statsDropDown.ShowDropDown(statsDropDownPanelTemplate, 230, statsDropDownOptions, setupItem);
|
||||||
statsDropDownOptions[0].OnClick();
|
statsDropDownOptions[0].OnClick();
|
||||||
|
|
||||||
var keyListener = statsDropDown.Get<LogicKeyListenerWidget>("STATS_DROPDOWN_KEYHANDLER");
|
var keyListener = statsDropDown.Get<LogicKeyListenerWidget>("STATS_DROPDOWN_KEYHANDLER");
|
||||||
@@ -190,6 +196,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
economyStatsHeaders.Visible = false;
|
economyStatsHeaders.Visible = false;
|
||||||
productionStatsHeaders.Visible = false;
|
productionStatsHeaders.Visible = false;
|
||||||
supportPowerStatsHeaders.Visible = false;
|
supportPowerStatsHeaders.Visible = false;
|
||||||
|
armyHeaders.Visible = false;
|
||||||
combatStatsHeaders.Visible = false;
|
combatStatsHeaders.Visible = false;
|
||||||
|
|
||||||
incomeGraphContainer.Visible = false;
|
incomeGraphContainer.Visible = false;
|
||||||
@@ -343,6 +350,27 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScrollItemWidget ArmyStats(Player player)
|
||||||
|
{
|
||||||
|
armyHeaders.Visible = true;
|
||||||
|
var template = SetupPlayerScrollItemWidget(armyPlayerTemplate, player);
|
||||||
|
|
||||||
|
AddPlayerFlagAndName(template, player);
|
||||||
|
|
||||||
|
var playerName = template.Get<LabelWidget>("PLAYER");
|
||||||
|
playerName.GetColor = () => Color.White;
|
||||||
|
|
||||||
|
var playerColor = template.Get<ColorBlockWidget>("PLAYER_COLOR");
|
||||||
|
var playerGradient = template.Get<GradientColorBlockWidget>("PLAYER_GRADIENT");
|
||||||
|
|
||||||
|
SetupPlayerColor(player, template, playerColor, playerGradient);
|
||||||
|
|
||||||
|
template.Get<ObserverArmyIconsWidget>("ARMY_ICONS").GetPlayer = () => player;
|
||||||
|
template.IgnoreChildMouseOver = false;
|
||||||
|
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
|
||||||
ScrollItemWidget EconomyStats(Player player)
|
ScrollItemWidget EconomyStats(Player player)
|
||||||
{
|
{
|
||||||
economyStatsHeaders.Visible = true;
|
economyStatsHeaders.Visible = true;
|
||||||
|
|||||||
209
OpenRA.Mods.Common/Widgets/ObserverArmyIconsWidget.cs
Normal file
209
OpenRA.Mods.Common/Widgets/ObserverArmyIconsWidget.cs
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation, either version 3 of
|
||||||
|
* the License, or (at your option) any later version. For more
|
||||||
|
* information, see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Mods.Common.Traits;
|
||||||
|
using OpenRA.Primitives;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.Widgets
|
||||||
|
{
|
||||||
|
public class ObserverArmyIconsWidget : Widget
|
||||||
|
{
|
||||||
|
public Func<Player> GetPlayer;
|
||||||
|
readonly World world;
|
||||||
|
readonly WorldRenderer worldRenderer;
|
||||||
|
|
||||||
|
public int IconWidth = 32;
|
||||||
|
public int IconHeight = 24;
|
||||||
|
public int IconSpacing = 1;
|
||||||
|
|
||||||
|
float2 iconSize;
|
||||||
|
public int MinWidth = 240;
|
||||||
|
|
||||||
|
public ArmyUnit TooltipUnit { get; private set; }
|
||||||
|
public Func<ArmyUnit> GetTooltipUnit;
|
||||||
|
|
||||||
|
public readonly string TooltipTemplate = "ARMY_TOOLTIP";
|
||||||
|
public readonly string TooltipContainer;
|
||||||
|
|
||||||
|
readonly Lazy<TooltipContainerWidget> tooltipContainer;
|
||||||
|
readonly List<ArmyIcon> armyIcons = new List<ArmyIcon>();
|
||||||
|
|
||||||
|
readonly CachedTransform<Player, PlayerStatistics> stats = new CachedTransform<Player, PlayerStatistics>(player => player.PlayerActor.TraitOrDefault<PlayerStatistics>());
|
||||||
|
|
||||||
|
int lastIconIdx;
|
||||||
|
Rectangle currentIconBounds;
|
||||||
|
|
||||||
|
[ObjectCreator.UseCtor]
|
||||||
|
public ObserverArmyIconsWidget(World world, WorldRenderer worldRenderer)
|
||||||
|
{
|
||||||
|
this.world = world;
|
||||||
|
this.worldRenderer = worldRenderer;
|
||||||
|
|
||||||
|
GetTooltipUnit = () => TooltipUnit;
|
||||||
|
tooltipContainer = Exts.Lazy(() =>
|
||||||
|
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ObserverArmyIconsWidget(ObserverArmyIconsWidget other)
|
||||||
|
: base(other)
|
||||||
|
{
|
||||||
|
GetPlayer = other.GetPlayer;
|
||||||
|
world = other.world;
|
||||||
|
worldRenderer = other.worldRenderer;
|
||||||
|
|
||||||
|
IconWidth = other.IconWidth;
|
||||||
|
IconHeight = other.IconHeight;
|
||||||
|
IconSpacing = other.IconSpacing;
|
||||||
|
iconSize = new float2(IconWidth, IconHeight);
|
||||||
|
|
||||||
|
MinWidth = other.MinWidth;
|
||||||
|
|
||||||
|
TooltipUnit = other.TooltipUnit;
|
||||||
|
GetTooltipUnit = () => TooltipUnit;
|
||||||
|
|
||||||
|
TooltipTemplate = other.TooltipTemplate;
|
||||||
|
TooltipContainer = other.TooltipContainer;
|
||||||
|
|
||||||
|
tooltipContainer = Exts.Lazy(() =>
|
||||||
|
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Draw()
|
||||||
|
{
|
||||||
|
armyIcons.Clear();
|
||||||
|
|
||||||
|
var player = GetPlayer();
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var playerStatistics = stats.Update(player);
|
||||||
|
|
||||||
|
var items = playerStatistics.Units.Values
|
||||||
|
.Where(u => u.Count > 0 && u.Icon != null)
|
||||||
|
.OrderBy(u => u.ProductionQueueOrder)
|
||||||
|
.ThenBy(u => u.BuildPaletteOrder);
|
||||||
|
|
||||||
|
Game.Renderer.EnableAntialiasingFilter();
|
||||||
|
|
||||||
|
var queueCol = 0;
|
||||||
|
foreach (var unit in items)
|
||||||
|
{
|
||||||
|
var icon = unit.Icon;
|
||||||
|
var topLeftOffset = new int2(queueCol * (IconWidth + IconSpacing), 0);
|
||||||
|
|
||||||
|
var iconTopLeft = RenderOrigin + topLeftOffset;
|
||||||
|
var centerPosition = iconTopLeft;
|
||||||
|
|
||||||
|
WidgetUtils.DrawSHPCentered(icon.Image, centerPosition + 0.5f * iconSize, worldRenderer.Palette(unit.IconPalette), 0.5f);
|
||||||
|
|
||||||
|
armyIcons.Add(new ArmyIcon
|
||||||
|
{
|
||||||
|
Bounds = new Rectangle(iconTopLeft.X, iconTopLeft.Y, (int)iconSize.X, (int)iconSize.Y),
|
||||||
|
Unit = unit
|
||||||
|
});
|
||||||
|
|
||||||
|
queueCol++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bounds.Width = queueCol * (IconWidth + IconSpacing);
|
||||||
|
|
||||||
|
Game.Renderer.DisableAntialiasingFilter();
|
||||||
|
|
||||||
|
var bold = Game.Renderer.Fonts["TinyBold"];
|
||||||
|
foreach (var armyIcon in armyIcons)
|
||||||
|
{
|
||||||
|
var text = armyIcon.Unit.Count.ToString();
|
||||||
|
bold.DrawTextWithContrast(text, armyIcon.Bounds.Location + new float2(iconSize.X, 0) - new float2(bold.Measure(text).X, bold.TopOffset),
|
||||||
|
Color.White, Color.Black, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var parentWidth = Bounds.X + Bounds.Width;
|
||||||
|
Parent.Bounds.Width = parentWidth;
|
||||||
|
|
||||||
|
var gradient = Parent.Get<GradientColorBlockWidget>("PLAYER_GRADIENT");
|
||||||
|
|
||||||
|
var offset = gradient.Bounds.X - Bounds.X;
|
||||||
|
var gradientWidth = Math.Max(MinWidth - offset, queueCol * (IconWidth + IconSpacing));
|
||||||
|
|
||||||
|
gradient.Bounds.Width = gradientWidth;
|
||||||
|
var widestChildWidth = Parent.Parent.Children.Max(x => x.Bounds.Width);
|
||||||
|
|
||||||
|
Parent.Parent.Bounds.Width = Math.Max(25 + widestChildWidth, Bounds.Left + MinWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Widget Clone()
|
||||||
|
{
|
||||||
|
return new ObserverArmyIconsWidget(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void MouseEntered()
|
||||||
|
{
|
||||||
|
if (TooltipContainer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var armyIcon in armyIcons)
|
||||||
|
{
|
||||||
|
if (!armyIcon.Bounds.Contains(Viewport.LastMousePos))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
TooltipUnit = armyIcon.Unit;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
tooltipContainer.Value.SetTooltip(TooltipTemplate, new WidgetArgs { { "getTooltipUnit", GetTooltipUnit } });
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void MouseExited()
|
||||||
|
{
|
||||||
|
if (TooltipContainer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
tooltipContainer.Value.RemoveTooltip();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Tick()
|
||||||
|
{
|
||||||
|
if (lastIconIdx >= armyIcons.Count)
|
||||||
|
{
|
||||||
|
TooltipUnit = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TooltipUnit != null && currentIconBounds.Contains(Viewport.LastMousePos))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (var i = 0; i < armyIcons.Count; i++)
|
||||||
|
{
|
||||||
|
var armyIcon = armyIcons[i];
|
||||||
|
if (!armyIcon.Bounds.Contains(Viewport.LastMousePos))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
lastIconIdx = i;
|
||||||
|
currentIconBounds = armyIcon.Bounds;
|
||||||
|
TooltipUnit = armyIcon.Unit;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TooltipUnit = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ArmyIcon
|
||||||
|
{
|
||||||
|
public Rectangle Bounds { get; set; }
|
||||||
|
public ArmyUnit Unit { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -267,6 +267,7 @@ Container@OBSERVER_WIDGETS:
|
|||||||
StatisticsProductionKey: StatisticsProduction
|
StatisticsProductionKey: StatisticsProduction
|
||||||
StatisticsSupportPowersKey: StatisticsSupportPowers
|
StatisticsSupportPowersKey: StatisticsSupportPowers
|
||||||
StatisticsCombatKey: StatisticsCombat
|
StatisticsCombatKey: StatisticsCombat
|
||||||
|
StatisticsArmyKey: StatisticsArmy
|
||||||
StatisticsGraphKey: StatisticsGraph
|
StatisticsGraphKey: StatisticsGraph
|
||||||
StatisticsArmyGraphKey: StatisticsArmyGraph
|
StatisticsArmyGraphKey: StatisticsArmyGraph
|
||||||
X: 5
|
X: 5
|
||||||
@@ -542,6 +543,42 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Font: Bold
|
Font: Bold
|
||||||
Text: Support Powers
|
Text: Support Powers
|
||||||
Shadow: True
|
Shadow: True
|
||||||
|
Container@ARMY_HEADERS:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Width: 400
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Children:
|
||||||
|
ColorBlock@HEADER_COLOR:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Color: 00000090
|
||||||
|
Width: PARENT_RIGHT - 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
GradientColorBlock@HEADER_GRADIENT:
|
||||||
|
X: PARENT_RIGHT - 200
|
||||||
|
Y: 0
|
||||||
|
TopLeftColor: 00000090
|
||||||
|
BottomLeftColor: 00000090
|
||||||
|
Width: 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Label@PLAYER_HEADER:
|
||||||
|
X: 40
|
||||||
|
Y: 0
|
||||||
|
Width: 120
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Font: Bold
|
||||||
|
Text: Player
|
||||||
|
Align: Left
|
||||||
|
Shadow: True
|
||||||
|
Label@ARMY_HEADER:
|
||||||
|
X: 160
|
||||||
|
Y: 0
|
||||||
|
Width: 100
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Font: Bold
|
||||||
|
Text: Army
|
||||||
|
Shadow: True
|
||||||
Container@COMBAT_STATS_HEADERS:
|
Container@COMBAT_STATS_HEADERS:
|
||||||
X: 0
|
X: 0
|
||||||
Y: 0
|
Y: 0
|
||||||
@@ -911,6 +948,43 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Width: 0
|
Width: 0
|
||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
ScrollItem@ARMY_PLAYER_TEMPLATE:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Width: 400
|
||||||
|
Height: 24
|
||||||
|
BaseName: scrollitem-nohover
|
||||||
|
Children:
|
||||||
|
ColorBlock@PLAYER_COLOR:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Width: PARENT_RIGHT - 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
GradientColorBlock@PLAYER_GRADIENT:
|
||||||
|
X: PARENT_RIGHT - 200
|
||||||
|
Y: 0
|
||||||
|
Width: 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Image@FLAG:
|
||||||
|
X: 5
|
||||||
|
Y: 4
|
||||||
|
Width: 35
|
||||||
|
Height: PARENT_BOTTOM - 4
|
||||||
|
ImageName: random
|
||||||
|
ImageCollection: flags
|
||||||
|
Label@PLAYER:
|
||||||
|
X: 40
|
||||||
|
Y: 0
|
||||||
|
Width: 120
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Font: Bold
|
||||||
|
Shadow: True
|
||||||
|
ObserverArmyIcons@ARMY_ICONS:
|
||||||
|
X: 160
|
||||||
|
Y: 0
|
||||||
|
Width: 0
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
ScrollItem@COMBAT_PLAYER_TEMPLATE:
|
ScrollItem@COMBAT_PLAYER_TEMPLATE:
|
||||||
X: 0
|
X: 0
|
||||||
Y: 0
|
Y: 0
|
||||||
|
|||||||
@@ -353,6 +353,24 @@ Background@SUPPORT_POWER_TOOLTIP_FACTIONSUFFIX:
|
|||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
VAlign: Top
|
VAlign: Top
|
||||||
|
|
||||||
|
Background@ARMY_TOOLTIP:
|
||||||
|
Logic: ArmyTooltipLogic
|
||||||
|
Background: panel-black
|
||||||
|
Width: 200
|
||||||
|
Height: 65
|
||||||
|
Children:
|
||||||
|
Label@NAME:
|
||||||
|
X: 5
|
||||||
|
Y: 1
|
||||||
|
Height: 23
|
||||||
|
Font: Bold
|
||||||
|
Label@DESC:
|
||||||
|
X: 5
|
||||||
|
Y: 20
|
||||||
|
Height: 5
|
||||||
|
Font: TinyBold
|
||||||
|
VAlign: Top
|
||||||
|
|
||||||
Background@SPAWN_TOOLTIP:
|
Background@SPAWN_TOOLTIP:
|
||||||
Logic: SpawnSelectorTooltipLogic
|
Logic: SpawnSelectorTooltipLogic
|
||||||
Background: panel-black
|
Background: panel-black
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ Container@OBSERVER_WIDGETS:
|
|||||||
StatisticsProductionKey: StatisticsProduction
|
StatisticsProductionKey: StatisticsProduction
|
||||||
StatisticsSupportPowersKey: StatisticsSupportPowers
|
StatisticsSupportPowersKey: StatisticsSupportPowers
|
||||||
StatisticsCombatKey: StatisticsCombat
|
StatisticsCombatKey: StatisticsCombat
|
||||||
|
StatisticsArmyKey: StatisticsArmy
|
||||||
StatisticsGraphKey: StatisticsGraph
|
StatisticsGraphKey: StatisticsGraph
|
||||||
StatisticsArmyGraphKey: StatisticsArmyGraph
|
StatisticsArmyGraphKey: StatisticsArmyGraph
|
||||||
X: 5
|
X: 5
|
||||||
@@ -434,6 +435,42 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Font: Bold
|
Font: Bold
|
||||||
Text: Support Powers
|
Text: Support Powers
|
||||||
Shadow: True
|
Shadow: True
|
||||||
|
Container@ARMY_HEADERS:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Width: 400
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Children:
|
||||||
|
ColorBlock@HEADER_COLOR:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Color: 00000090
|
||||||
|
Width: PARENT_RIGHT - 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
GradientColorBlock@HEADER_GRADIENT:
|
||||||
|
X: PARENT_RIGHT - 200
|
||||||
|
Y: 0
|
||||||
|
TopLeftColor: 00000090
|
||||||
|
BottomLeftColor: 00000090
|
||||||
|
Width: 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Label@PLAYER_HEADER:
|
||||||
|
X: 40
|
||||||
|
Y: 0
|
||||||
|
Width: 120
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Font: Bold
|
||||||
|
Text: Player
|
||||||
|
Align: Left
|
||||||
|
Shadow: True
|
||||||
|
Label@ARMY_HEADER:
|
||||||
|
X: 160
|
||||||
|
Y: 0
|
||||||
|
Width: 100
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Font: Bold
|
||||||
|
Text: Army
|
||||||
|
Shadow: True
|
||||||
Container@COMBAT_STATS_HEADERS:
|
Container@COMBAT_STATS_HEADERS:
|
||||||
X: 0
|
X: 0
|
||||||
Y: 0
|
Y: 0
|
||||||
@@ -788,6 +825,43 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Width: 0
|
Width: 0
|
||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
ScrollItem@ARMY_PLAYER_TEMPLATE:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Width: 400
|
||||||
|
Height: 25
|
||||||
|
BaseName: scrollitem-nohover
|
||||||
|
Children:
|
||||||
|
ColorBlock@PLAYER_COLOR:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Width: PARENT_RIGHT - 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
GradientColorBlock@PLAYER_GRADIENT:
|
||||||
|
X: PARENT_RIGHT - 200
|
||||||
|
Y: 0
|
||||||
|
Width: 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Image@FLAG:
|
||||||
|
X: 5
|
||||||
|
Y: 4
|
||||||
|
Width: 35
|
||||||
|
Height: PARENT_BOTTOM - 4
|
||||||
|
ImageName: random
|
||||||
|
ImageCollection: flags
|
||||||
|
Label@PLAYER:
|
||||||
|
X: 35
|
||||||
|
Y: 0
|
||||||
|
Width: 120
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Font: Bold
|
||||||
|
Shadow: True
|
||||||
|
ObserverArmyIcons@ARMY_ICONS:
|
||||||
|
X: 155
|
||||||
|
Y: 0
|
||||||
|
Width: 0
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
ScrollItem@COMBAT_PLAYER_TEMPLATE:
|
ScrollItem@COMBAT_PLAYER_TEMPLATE:
|
||||||
X: 0
|
X: 0
|
||||||
Y: 0
|
Y: 0
|
||||||
|
|||||||
@@ -319,3 +319,21 @@ Background@SUPPORT_POWER_TOOLTIP:
|
|||||||
Y: 24
|
Y: 24
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
VAlign: Top
|
VAlign: Top
|
||||||
|
|
||||||
|
Background@ARMY_TOOLTIP:
|
||||||
|
Logic: ArmyTooltipLogic
|
||||||
|
Background: dialog4
|
||||||
|
Width: 200
|
||||||
|
Height: 65
|
||||||
|
Children:
|
||||||
|
Label@NAME:
|
||||||
|
X: 7
|
||||||
|
Y: 3
|
||||||
|
Height: 23
|
||||||
|
Font: Bold
|
||||||
|
Label@DESC:
|
||||||
|
X: 7
|
||||||
|
Y: 27
|
||||||
|
Height: 2
|
||||||
|
Font: TinyBold
|
||||||
|
VAlign: Top
|
||||||
|
|||||||
@@ -46,10 +46,14 @@ StatisticsCombat: F6
|
|||||||
Description: Combat statistics
|
Description: Combat statistics
|
||||||
Types: Observer, Replay, Spectator
|
Types: Observer, Replay, Spectator
|
||||||
|
|
||||||
StatisticsGraph: F7
|
StatisticsArmy: F7
|
||||||
|
Description: Army statistics
|
||||||
|
Types: Observer, Replay, Spectator
|
||||||
|
|
||||||
|
StatisticsGraph:
|
||||||
Description: Statistics graph
|
Description: Statistics graph
|
||||||
Types: Observer, Replay, Spectator
|
Types: Observer, Replay, Spectator
|
||||||
|
|
||||||
StatisticsArmyGraph: F8
|
StatisticsArmyGraph:
|
||||||
Description: Army value graph
|
Description: Army value graph
|
||||||
Types: Observer, Replay, Spectator
|
Types: Observer, Replay, Spectator
|
||||||
|
|||||||
@@ -321,3 +321,21 @@ Background@SUPPORT_POWER_TOOLTIP:
|
|||||||
Y: 30
|
Y: 30
|
||||||
Font: TinyBold
|
Font: TinyBold
|
||||||
VAlign: Top
|
VAlign: Top
|
||||||
|
|
||||||
|
Background@ARMY_TOOLTIP:
|
||||||
|
Logic: ArmyTooltipLogic
|
||||||
|
Background: dialog3
|
||||||
|
Width: 200
|
||||||
|
Height: 65
|
||||||
|
Children:
|
||||||
|
Label@NAME:
|
||||||
|
X: 7
|
||||||
|
Y: 3
|
||||||
|
Height: 23
|
||||||
|
Font: Bold
|
||||||
|
Label@DESC:
|
||||||
|
X: 7
|
||||||
|
Y: 23
|
||||||
|
Height: 3
|
||||||
|
Font: TinyBold
|
||||||
|
VAlign: Top
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ mcv.starport:
|
|||||||
-MapEditorData:
|
-MapEditorData:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Image: mcv
|
Image: mcv
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
OverrideActor: mcv
|
||||||
|
|
||||||
harvester.starport:
|
harvester.starport:
|
||||||
Inherits: harvester
|
Inherits: harvester
|
||||||
@@ -19,6 +21,8 @@ harvester.starport:
|
|||||||
-MapEditorData:
|
-MapEditorData:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Image: harvester
|
Image: harvester
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
OverrideActor: harvester
|
||||||
|
|
||||||
trike.starport:
|
trike.starport:
|
||||||
Inherits: trike
|
Inherits: trike
|
||||||
@@ -30,6 +34,8 @@ trike.starport:
|
|||||||
-MapEditorData:
|
-MapEditorData:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Image: trike
|
Image: trike
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
OverrideActor: trike
|
||||||
|
|
||||||
quad.starport:
|
quad.starport:
|
||||||
Inherits: quad
|
Inherits: quad
|
||||||
@@ -41,6 +47,8 @@ quad.starport:
|
|||||||
-MapEditorData:
|
-MapEditorData:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Image: quad
|
Image: quad
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
OverrideActor: quad
|
||||||
|
|
||||||
siege_tank.starport:
|
siege_tank.starport:
|
||||||
Inherits: siege_tank
|
Inherits: siege_tank
|
||||||
@@ -52,6 +60,8 @@ siege_tank.starport:
|
|||||||
-MapEditorData:
|
-MapEditorData:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Image: siege_tank
|
Image: siege_tank
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
OverrideActor: siege_tank
|
||||||
|
|
||||||
missile_tank.starport:
|
missile_tank.starport:
|
||||||
Inherits: missile_tank
|
Inherits: missile_tank
|
||||||
@@ -63,6 +73,8 @@ missile_tank.starport:
|
|||||||
-MapEditorData:
|
-MapEditorData:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Image: missile_tank
|
Image: missile_tank
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
OverrideActor: missile_tank
|
||||||
|
|
||||||
combat_tank_a.starport:
|
combat_tank_a.starport:
|
||||||
Inherits: combat_tank_a
|
Inherits: combat_tank_a
|
||||||
@@ -74,6 +86,8 @@ combat_tank_a.starport:
|
|||||||
-MapEditorData:
|
-MapEditorData:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Image: combat_tank_a
|
Image: combat_tank_a
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
OverrideActor: combat_tank_a
|
||||||
|
|
||||||
combat_tank_h.starport:
|
combat_tank_h.starport:
|
||||||
Inherits: combat_tank_h
|
Inherits: combat_tank_h
|
||||||
@@ -85,6 +99,8 @@ combat_tank_h.starport:
|
|||||||
-MapEditorData:
|
-MapEditorData:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Image: combat_tank_h
|
Image: combat_tank_h
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
OverrideActor: combat_tank_h
|
||||||
|
|
||||||
combat_tank_o.starport:
|
combat_tank_o.starport:
|
||||||
Inherits: combat_tank_o
|
Inherits: combat_tank_o
|
||||||
@@ -96,6 +112,8 @@ combat_tank_o.starport:
|
|||||||
-MapEditorData:
|
-MapEditorData:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Image: combat_tank_o
|
Image: combat_tank_o
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
OverrideActor: combat_tank_o
|
||||||
|
|
||||||
carryall.starport:
|
carryall.starport:
|
||||||
Inherits: carryall
|
Inherits: carryall
|
||||||
@@ -105,3 +123,5 @@ carryall.starport:
|
|||||||
Valued:
|
Valued:
|
||||||
Cost: 1500
|
Cost: 1500
|
||||||
-MapEditorData:
|
-MapEditorData:
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
OverrideActor: carryall
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ Container@OBSERVER_WIDGETS:
|
|||||||
StatisticsProductionKey: StatisticsProduction
|
StatisticsProductionKey: StatisticsProduction
|
||||||
StatisticsSupportPowersKey: StatisticsSupportPowers
|
StatisticsSupportPowersKey: StatisticsSupportPowers
|
||||||
StatisticsCombatKey: StatisticsCombat
|
StatisticsCombatKey: StatisticsCombat
|
||||||
|
StatisticsArmyKey: StatisticsArmy
|
||||||
StatisticsGraphKey: StatisticsGraph
|
StatisticsGraphKey: StatisticsGraph
|
||||||
StatisticsArmyGraphKey: StatisticsArmyGraph
|
StatisticsArmyGraphKey: StatisticsArmyGraph
|
||||||
StatsDropDownPanelTemplate: SPECTATOR_LABEL_DROPDOWN_TEMPLATE
|
StatsDropDownPanelTemplate: SPECTATOR_LABEL_DROPDOWN_TEMPLATE
|
||||||
@@ -481,6 +482,42 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Font: Bold
|
Font: Bold
|
||||||
Text: Support Powers
|
Text: Support Powers
|
||||||
Shadow: True
|
Shadow: True
|
||||||
|
Container@ARMY_HEADERS:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Width: 400
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Children:
|
||||||
|
ColorBlock@HEADER_COLOR:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Color: 00000090
|
||||||
|
Width: PARENT_RIGHT - 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
GradientColorBlock@HEADER_GRADIENT:
|
||||||
|
X: PARENT_RIGHT - 200
|
||||||
|
Y: 0
|
||||||
|
TopLeftColor: 00000090
|
||||||
|
BottomLeftColor: 00000090
|
||||||
|
Width: 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Label@PLAYER_HEADER:
|
||||||
|
X: 40
|
||||||
|
Y: 0
|
||||||
|
Width: 120
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Font: Bold
|
||||||
|
Text: Player
|
||||||
|
Align: Left
|
||||||
|
Shadow: True
|
||||||
|
Label@ARMY_HEADER:
|
||||||
|
X: 160
|
||||||
|
Y: 0
|
||||||
|
Width: 100
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Font: Bold
|
||||||
|
Text: Army
|
||||||
|
Shadow: True
|
||||||
Container@COMBAT_STATS_HEADERS:
|
Container@COMBAT_STATS_HEADERS:
|
||||||
X: 0
|
X: 0
|
||||||
Y: 0
|
Y: 0
|
||||||
@@ -852,6 +889,43 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Width: 0
|
Width: 0
|
||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
ScrollItem@ARMY_PLAYER_TEMPLATE:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Width: 400
|
||||||
|
Height: 24
|
||||||
|
BaseName: scrollitem-nohover
|
||||||
|
Children:
|
||||||
|
ColorBlock@PLAYER_COLOR:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Width: PARENT_RIGHT - 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
GradientColorBlock@PLAYER_GRADIENT:
|
||||||
|
X: PARENT_RIGHT - 200
|
||||||
|
Y: 0
|
||||||
|
Width: 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Image@FLAG:
|
||||||
|
X: 5
|
||||||
|
Y: 4
|
||||||
|
Width: 35
|
||||||
|
Height: PARENT_BOTTOM - 4
|
||||||
|
ImageName: random
|
||||||
|
ImageCollection: flags
|
||||||
|
Label@PLAYER:
|
||||||
|
X: 40
|
||||||
|
Y: 0
|
||||||
|
Width: 120
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Font: Bold
|
||||||
|
Shadow: True
|
||||||
|
ObserverArmyIcons@ARMY_ICONS:
|
||||||
|
X: 160
|
||||||
|
Y: 0
|
||||||
|
Width: 0
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
ScrollItem@COMBAT_PLAYER_TEMPLATE:
|
ScrollItem@COMBAT_PLAYER_TEMPLATE:
|
||||||
X: 0
|
X: 0
|
||||||
Y: 0
|
Y: 0
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ E1R1:
|
|||||||
ProducibleWithLevel:
|
ProducibleWithLevel:
|
||||||
Prerequisites: techlevel.infonly
|
Prerequisites: techlevel.infonly
|
||||||
InitialLevels: 1
|
InitialLevels: 1
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
OverrideActor: e1
|
||||||
-Buildable:
|
-Buildable:
|
||||||
|
|
||||||
E2:
|
E2:
|
||||||
@@ -199,6 +201,8 @@ E3R1:
|
|||||||
ProducibleWithLevel:
|
ProducibleWithLevel:
|
||||||
Prerequisites: techlevel.infonly
|
Prerequisites: techlevel.infonly
|
||||||
InitialLevels: 1
|
InitialLevels: 1
|
||||||
|
UpdatesPlayerStatistics:
|
||||||
|
OverrideActor: e3
|
||||||
-Buildable:
|
-Buildable:
|
||||||
|
|
||||||
E4:
|
E4:
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ Container@OBSERVER_WIDGETS:
|
|||||||
StatisticsProductionKey: StatisticsProduction
|
StatisticsProductionKey: StatisticsProduction
|
||||||
StatisticsSupportPowersKey: StatisticsSupportPowers
|
StatisticsSupportPowersKey: StatisticsSupportPowers
|
||||||
StatisticsCombatKey: StatisticsCombat
|
StatisticsCombatKey: StatisticsCombat
|
||||||
|
StatisticsArmyKey: StatisticsArmy
|
||||||
StatisticsGraphKey: StatisticsGraph
|
StatisticsGraphKey: StatisticsGraph
|
||||||
StatisticsArmyGraphKey: StatisticsArmyGraph
|
StatisticsArmyGraphKey: StatisticsArmyGraph
|
||||||
X: 5
|
X: 5
|
||||||
@@ -434,6 +435,42 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Font: Bold
|
Font: Bold
|
||||||
Text: Support Powers
|
Text: Support Powers
|
||||||
Shadow: True
|
Shadow: True
|
||||||
|
Container@ARMY_HEADERS:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Width: 400
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Children:
|
||||||
|
ColorBlock@HEADER_COLOR:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Color: 00000090
|
||||||
|
Width: PARENT_RIGHT - 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
GradientColorBlock@HEADER_GRADIENT:
|
||||||
|
X: PARENT_RIGHT - 200
|
||||||
|
Y: 0
|
||||||
|
TopLeftColor: 00000090
|
||||||
|
BottomLeftColor: 00000090
|
||||||
|
Width: 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Label@PLAYER_HEADER:
|
||||||
|
X: 40
|
||||||
|
Y: 0
|
||||||
|
Width: 120
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Font: Bold
|
||||||
|
Text: Player
|
||||||
|
Align: Left
|
||||||
|
Shadow: True
|
||||||
|
Label@ARMY_HEADER:
|
||||||
|
X: 160
|
||||||
|
Y: 0
|
||||||
|
Width: 100
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Font: Bold
|
||||||
|
Text: Army
|
||||||
|
Shadow: True
|
||||||
Container@COMBAT_STATS_HEADERS:
|
Container@COMBAT_STATS_HEADERS:
|
||||||
X: 0
|
X: 0
|
||||||
Y: 0
|
Y: 0
|
||||||
@@ -798,6 +835,43 @@ Container@OBSERVER_WIDGETS:
|
|||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM
|
||||||
ClockPalette: iconclock
|
ClockPalette: iconclock
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
ScrollItem@ARMY_PLAYER_TEMPLATE:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Width: 400
|
||||||
|
Height: 24
|
||||||
|
BaseName: scrollitem-nohover
|
||||||
|
Children:
|
||||||
|
ColorBlock@PLAYER_COLOR:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Width: PARENT_RIGHT - 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
GradientColorBlock@PLAYER_GRADIENT:
|
||||||
|
X: PARENT_RIGHT - 200
|
||||||
|
Y: 0
|
||||||
|
Width: 200
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Image@FLAG:
|
||||||
|
X: 5
|
||||||
|
Y: 4
|
||||||
|
Width: 35
|
||||||
|
Height: PARENT_BOTTOM - 4
|
||||||
|
ImageName: random
|
||||||
|
ImageCollection: flags
|
||||||
|
Label@PLAYER:
|
||||||
|
X: 40
|
||||||
|
Y: 0
|
||||||
|
Width: 120
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
Font: Bold
|
||||||
|
Shadow: True
|
||||||
|
ObserverArmyIcons@ARMY_ICONS:
|
||||||
|
X: 160
|
||||||
|
Y: 0
|
||||||
|
Width: 0
|
||||||
|
Height: PARENT_BOTTOM
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
ScrollItem@COMBAT_PLAYER_TEMPLATE:
|
ScrollItem@COMBAT_PLAYER_TEMPLATE:
|
||||||
X: 0
|
X: 0
|
||||||
Y: 0
|
Y: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user