Add tooltips for the power and cash displays.

This commit is contained in:
Paul Chote
2014-07-17 18:51:38 +12:00
parent f7f01cc08e
commit 7c9223caea
5 changed files with 91 additions and 28 deletions

View File

@@ -11,7 +11,7 @@
using OpenRA.Traits;
using OpenRA.Widgets;
namespace OpenRA.Mods.Cnc.Widgets.Logic
namespace OpenRA.Mods.RA.Widgets.Logic
{
public class IngameCashCounterLogic
{
@@ -19,10 +19,11 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
public IngameCashCounterLogic(Widget widget, World world)
{
var playerResources = world.LocalPlayer.PlayerActor.Trait<PlayerResources>();
var cash = widget.Get<LabelWidget>("CASH");
var cash = widget.Get<LabelWithTooltipWidget>("CASH");
var label = cash.Text;
cash.GetText = () => label.F(playerResources.DisplayCash + playerResources.DisplayResources);
cash.GetTooltipText = () => "Silo Usage: {0}/{1}".F(playerResources.Resources, playerResources.ResourceCapacity);
}
}
}