move all databinding for the silobar into ui logic

This commit is contained in:
Chris Forbes
2012-09-25 19:39:33 +12:00
parent af31ae4931
commit c42f270ce0
3 changed files with 17 additions and 17 deletions

View File

@@ -152,6 +152,17 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
InitObserverWidgets(world, playerRoot);
});
};
var siloBar = playerWidgets.Get<SiloBarWidget>("SILOBAR");
siloBar.GetProvided = () => playerResources.OreCapacity;
siloBar.GetUsed = () => playerResources.Ore;
siloBar.TooltipFormat = "Silo Usage: {0}/{1}";
siloBar.GetBarColor = () =>
{
if (playerResources.Ore == playerResources.OreCapacity) return Color.Red;
if (playerResources.Ore >= 0.8 * playerResources.OreCapacity) return Color.Orange;
return Color.LimeGreen;
};
}
static void BindOrderButton<T>(World world, Widget parent, string button, string icon)