fix needless use of reflection
This commit is contained in:
@@ -46,16 +46,19 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
|
|
||||||
foreach (var game in GameList)
|
foreach (var game in GameList)
|
||||||
{
|
{
|
||||||
ButtonWidget b = new ButtonWidget();
|
var b = new ButtonWidget
|
||||||
b.Bounds = new Rectangle(bg.Bounds.X + 20, bg.Bounds.Y + height, width, 25);
|
{
|
||||||
b.GetType().GetField("Id").SetValue(b, "JOIN_GAME_{0}".F(i));
|
Bounds = new Rectangle(bg.Bounds.X + 20, bg.Bounds.Y + height, width, 25),
|
||||||
b.GetType().GetField("Text").SetValue(b, "{0} ({1})".F(game.Name, game.Address));
|
Id = "JOIN_GAME_{0}".F( i ),
|
||||||
b.GetType().GetField("Delegate").SetValue(b, "ServerBrowserDelegate");
|
Text = "{0} ({1})".F( game.Name, game.Address ),
|
||||||
|
Delegate = "ServerBrowserDelegate",
|
||||||
|
|
||||||
b.OnMouseUp = nmi => {
|
OnMouseUp = nmi =>
|
||||||
r.GetWidget("JOINSERVER_BG").Visible = false;
|
{
|
||||||
Game.JoinServer(GameList[i].Address.Split(':')[0], int.Parse(GameList[i].Address.Split(':')[1]));
|
r.GetWidget("JOINSERVER_BG").Visible = false;
|
||||||
return true;
|
Game.JoinServer(GameList[i].Address.Split(':')[0], int.Parse(GameList[i].Address.Split(':')[1]));
|
||||||
|
return true;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
bg.AddChild(b);
|
bg.AddChild(b);
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ namespace OpenRA.Widgets
|
|||||||
public class Widget
|
public class Widget
|
||||||
{
|
{
|
||||||
// Info defined in YAML
|
// Info defined in YAML
|
||||||
public readonly string Id = null;
|
public string Id = null;
|
||||||
public readonly string X = "0";
|
public string X = "0";
|
||||||
public readonly string Y = "0";
|
public string Y = "0";
|
||||||
public readonly string Width = "0";
|
public string Width = "0";
|
||||||
public readonly string Height = "0";
|
public string Height = "0";
|
||||||
public readonly string Delegate = null;
|
public string Delegate = null;
|
||||||
public readonly bool ClickThrough = false;
|
public bool ClickThrough = false;
|
||||||
public bool Visible = true;
|
public bool Visible = true;
|
||||||
public readonly List<Widget> Children = new List<Widget>();
|
public readonly List<Widget> Children = new List<Widget>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user