diff --git a/OpenRA.Game/Widgets/ButtonWidget.cs b/OpenRA.Game/Widgets/ButtonWidget.cs index cd7facaa73..3dbb483533 100644 --- a/OpenRA.Game/Widgets/ButtonWidget.cs +++ b/OpenRA.Game/Widgets/ButtonWidget.cs @@ -17,7 +17,13 @@ namespace OpenRA.Widgets { public class ButtonWidget : Widget { - public string Key = null; + public Func GetKey = _ => null; + public string Key + { + get { return GetKey(this); } + set { GetKey = _ => value; } + } + public string Text = ""; public bool Depressed = false; public int VisualHeight = ChromeMetrics.Get("ButtonDepth"); diff --git a/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs index 640e1b79c8..f65470eeef 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/IngameChromeLogic.cs @@ -54,9 +54,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic } var moneybin = gameRoot.Get("INGAME_MONEY_BIN"); - moneybin.Get("SELL").Key = Game.Settings.Keys.SellKey; - moneybin.Get("POWER_DOWN").Key = Game.Settings.Keys.PowerDownKey; - moneybin.Get("REPAIR").Key = Game.Settings.Keys.RepairKey; + moneybin.Get("SELL").GetKey = _ => Game.Settings.Keys.SellKey; + moneybin.Get("POWER_DOWN").GetKey = _ => Game.Settings.Keys.PowerDownKey; + moneybin.Get("REPAIR").GetKey = _ => Game.Settings.Keys.RepairKey; optionsBG.Get("DISCONNECT").OnClick = () => LeaveGame(optionsBG, world);