fixes #2866: added ButtonWidget.GetKey as delegate
This commit is contained in:
@@ -17,7 +17,13 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
public class ButtonWidget : Widget
|
public class ButtonWidget : Widget
|
||||||
{
|
{
|
||||||
public string Key = null;
|
public Func<ButtonWidget, string> GetKey = _ => null;
|
||||||
|
public string Key
|
||||||
|
{
|
||||||
|
get { return GetKey(this); }
|
||||||
|
set { GetKey = _ => value; }
|
||||||
|
}
|
||||||
|
|
||||||
public string Text = "";
|
public string Text = "";
|
||||||
public bool Depressed = false;
|
public bool Depressed = false;
|
||||||
public int VisualHeight = ChromeMetrics.Get<int>("ButtonDepth");
|
public int VisualHeight = ChromeMetrics.Get<int>("ButtonDepth");
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
var moneybin = gameRoot.Get("INGAME_MONEY_BIN");
|
var moneybin = gameRoot.Get("INGAME_MONEY_BIN");
|
||||||
moneybin.Get<OrderButtonWidget>("SELL").Key = Game.Settings.Keys.SellKey;
|
moneybin.Get<OrderButtonWidget>("SELL").GetKey = _ => Game.Settings.Keys.SellKey;
|
||||||
moneybin.Get<OrderButtonWidget>("POWER_DOWN").Key = Game.Settings.Keys.PowerDownKey;
|
moneybin.Get<OrderButtonWidget>("POWER_DOWN").GetKey = _ => Game.Settings.Keys.PowerDownKey;
|
||||||
moneybin.Get<OrderButtonWidget>("REPAIR").Key = Game.Settings.Keys.RepairKey;
|
moneybin.Get<OrderButtonWidget>("REPAIR").GetKey = _ => Game.Settings.Keys.RepairKey;
|
||||||
|
|
||||||
optionsBG.Get<ButtonWidget>("DISCONNECT").OnClick = () => LeaveGame(optionsBG, world);
|
optionsBG.Get<ButtonWidget>("DISCONNECT").OnClick = () => LeaveGame(optionsBG, world);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user