From 84f7aa56e1eda2e9e797ec702058181f028c756c Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 25 Sep 2012 19:43:57 +1200 Subject: [PATCH] make ResourceBarWidget generic --- OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj | 2 +- OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs | 3 ++- .../Widgets/{SiloBarWidget.cs => ResourceBarWidget.cs} | 4 ++-- mods/cnc/chrome/ingame.yaml | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) rename OpenRA.Mods.Cnc/Widgets/{SiloBarWidget.cs => ResourceBarWidget.cs} (96%) diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj index cfdc6019f5..4c4da7cdad 100644 --- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj +++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj @@ -110,12 +110,12 @@ - + diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs index a4ecd7282f..63339018b2 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncIngameChromeLogic.cs @@ -153,10 +153,11 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic }); }; - var siloBar = playerWidgets.Get("SILOBAR"); + var siloBar = playerWidgets.Get("SILOBAR"); siloBar.GetProvided = () => playerResources.OreCapacity; siloBar.GetUsed = () => playerResources.Ore; siloBar.TooltipFormat = "Silo Usage: {0}/{1}"; + siloBar.RightIndicator = true; siloBar.GetBarColor = () => { if (playerResources.Ore == playerResources.OreCapacity) return Color.Red; diff --git a/OpenRA.Mods.Cnc/Widgets/SiloBarWidget.cs b/OpenRA.Mods.Cnc/Widgets/ResourceBarWidget.cs similarity index 96% rename from OpenRA.Mods.Cnc/Widgets/SiloBarWidget.cs rename to OpenRA.Mods.Cnc/Widgets/ResourceBarWidget.cs index 40b86106ab..7038fb46ba 100755 --- a/OpenRA.Mods.Cnc/Widgets/SiloBarWidget.cs +++ b/OpenRA.Mods.Cnc/Widgets/ResourceBarWidget.cs @@ -17,7 +17,7 @@ using OpenRA.Widgets; namespace OpenRA.Mods.Cnc.Widgets { - public class SiloBarWidget : Widget + public class ResourceBarWidget : Widget { public readonly string TooltipTemplate = "SIMPLE_TOOLTIP"; public readonly string TooltipContainer; @@ -34,7 +34,7 @@ namespace OpenRA.Mods.Cnc.Widgets public Func GetBarColor = () => Color.White; [ObjectCreator.UseCtor] - public SiloBarWidget(World world) + public ResourceBarWidget(World world) { tooltipContainer = Lazy.New(() => Ui.Root.Get(TooltipContainer)); diff --git a/mods/cnc/chrome/ingame.yaml b/mods/cnc/chrome/ingame.yaml index 28057c5873..e7a8eeb7b6 100644 --- a/mods/cnc/chrome/ingame.yaml +++ b/mods/cnc/chrome/ingame.yaml @@ -170,7 +170,7 @@ Container@PLAYER_WIDGETS: Height:168 Background:panel-black Children: - SiloBar@SILOBAR: + ResourceBar@SILOBAR: X:1 Y:1 Width:PARENT_RIGHT-2