make ResourceBarWidget generic
This commit is contained in:
@@ -153,10 +153,11 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
||||
});
|
||||
};
|
||||
|
||||
var siloBar = playerWidgets.Get<SiloBarWidget>("SILOBAR");
|
||||
var siloBar = playerWidgets.Get<ResourceBarWidget>("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;
|
||||
|
||||
@@ -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<Color> GetBarColor = () => Color.White;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public SiloBarWidget(World world)
|
||||
public ResourceBarWidget(World world)
|
||||
{
|
||||
tooltipContainer = Lazy.New(() =>
|
||||
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
|
||||
Reference in New Issue
Block a user