#2051 fixed -- Widget.Get() throws by default

This commit is contained in:
Chris Forbes
2012-04-27 19:39:07 +12:00
parent 5d1a071287
commit c30d46c014
52 changed files with 409 additions and 398 deletions

View File

@@ -21,9 +21,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{
/* todo: attach this to the correct widget, to remove the lookups below */
var r = Ui.Root;
var gameRoot = r.GetWidget("INGAME_ROOT");
var gameRoot = r.Get("INGAME_ROOT");
var moneybin = gameRoot.GetWidget("INGAME_MONEY_BIN");
var moneybin = gameRoot.Get("INGAME_MONEY_BIN");
moneybin.IsVisible = () => {
return world.LocalPlayer.WinState == WinState.Undefined;
};
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
static void BindOrderButton<T>(World world, Widget parent, string button)
where T : IOrderGenerator, new()
{
var w = parent.GetWidget<OrderButtonWidget>(button);
var w = parent.GetOrNull<OrderButtonWidget>(button);
if (w != null)
{
w.Pressed = () => world.OrderGenerator is T;