Merge tooltip support into Button and remove ToggleButton.

This commit is contained in:
Paul Chote
2013-04-08 23:01:21 +12:00
parent eddc1fc0cf
commit f368556b23
7 changed files with 48 additions and 77 deletions

View File

@@ -15,7 +15,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
public class ButtonTooltipLogic
{
[ObjectCreator.UseCtor]
public ButtonTooltipLogic(Widget widget, ToggleButtonWidget button)
public ButtonTooltipLogic(Widget widget, ButtonWidget button)
{
var label = widget.Get<LabelWidget>("LABEL");
var hotkey = widget.Get<LabelWidget>("HOTKEY");

View File

@@ -90,8 +90,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
BindOrderButton<SellOrderGenerator>(world, sidebarRoot, "SELL_BUTTON", "sell");
BindOrderButton<RepairOrderGenerator>(world, sidebarRoot, "REPAIR_BUTTON", "repair");
sidebarRoot.Get<ToggleButtonWidget>("SELL_BUTTON").Key = Game.Settings.Keys.SellKey;
sidebarRoot.Get<ToggleButtonWidget>("REPAIR_BUTTON").Key = Game.Settings.Keys.RepairKey;
sidebarRoot.Get<ButtonWidget>("SELL_BUTTON").Key = Game.Settings.Keys.SellKey;
sidebarRoot.Get<ButtonWidget>("REPAIR_BUTTON").Key = Game.Settings.Keys.RepairKey;
var powerManager = world.LocalPlayer.PlayerActor.Trait<PowerManager>();
var playerResources = world.LocalPlayer.PlayerActor.Trait<PlayerResources>();
@@ -139,7 +139,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
static void BindOrderButton<T>(World world, Widget parent, string button, string icon)
where T : IOrderGenerator, new()
{
var w = parent.Get<ToggleButtonWidget>(button);
var w = parent.Get<ButtonWidget>(button);
w.OnClick = () => world.ToggleInputMode<T>();
w.IsHighlighted = () => world.OrderGenerator is T;