make ResourceBarWidget generic
This commit is contained in:
@@ -110,12 +110,12 @@
|
||||
<Compile Include="Widgets\PowerBarWidget.cs" />
|
||||
<Compile Include="Widgets\ProductionPaletteWidget.cs" />
|
||||
<Compile Include="Widgets\ProductionTabsWidget.cs" />
|
||||
<Compile Include="Widgets\SiloBarWidget.cs" />
|
||||
<Compile Include="Widgets\SupportPowersWidget.cs" />
|
||||
<Compile Include="Widgets\ToggleButtonWidget.cs" />
|
||||
<Compile Include="Widgets\TooltipContainerWidget.cs" />
|
||||
<Compile Include="WithFire.cs" />
|
||||
<Compile Include="WithRoof.cs" />
|
||||
<Compile Include="Widgets\ResourceBarWidget.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||
|
||||
@@ -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));
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user