fix paul's hacky direct connect button

This commit is contained in:
Chris Forbes
2010-04-19 21:00:16 +12:00
parent bc71b21aca
commit eed59a49f9
2 changed files with 11 additions and 4 deletions

View File

@@ -55,8 +55,8 @@ namespace OpenRA.Widgets.Delegates
r.GetWidget("JOINSERVER_PROGRESS_TITLE").Visible = false; r.GetWidget("JOINSERVER_PROGRESS_TITLE").Visible = false;
var margin = 20;
int height = 50; int height = 50;
int width = 300;
int i = 0; int i = 0;
foreach (var game in games) foreach (var game in games)
@@ -64,7 +64,7 @@ namespace OpenRA.Widgets.Delegates
var g = game; var g = game;
var b = new ButtonWidget var b = new ButtonWidget
{ {
Bounds = new Rectangle(bg.Bounds.X + 20, bg.Bounds.Y + height, width, 25), Bounds = new Rectangle(bg.Bounds.X + margin, bg.Bounds.Y + height, bg.Bounds.Width - 2 * margin, 25),
Id = "JOIN_GAME_{0}".F(i), Id = "JOIN_GAME_{0}".F(i),
Text = "{0} ({1})".F(game.Name, game.Address), Text = "{0} ({1})".F(game.Name, game.Address),
Delegate = "ServerBrowserDelegate", Delegate = "ServerBrowserDelegate",
@@ -120,6 +120,13 @@ namespace OpenRA.Widgets.Delegates
r.CloseWindow(); r.CloseWindow();
return true; return true;
}; };
r.GetWidget("JOINSERVER_BUTTON_DIRECTCONNECT").OnMouseUp = mi =>
{ /* rude hack. kill this as soon as we can do a direct connect via the commandline */
r.CloseWindow();
Game.JoinServer(Game.Settings.NetworkHost, Game.Settings.NetworkPort);
return true;
};
} }
} }
} }

View File

@@ -168,8 +168,8 @@ Container:
Height:25 Height:25
Text:Fetching games... Text:Fetching games...
Align:Center Align:Center
Button@JOINSERVER_BUTTON_DIRECT_CONNECT: Button@JOINSERVER_BUTTON_DIRECTCONNECT:
Id:JOINSERVER_BUTTON_DIRECT_CONNECT Id:JOINSERVER_BUTTON_DIRECTCONNECT
X:PARENT_RIGHT - 140 - 130 - 130 X:PARENT_RIGHT - 140 - 130 - 130
Y:PARENT_BOTTOM - 45 Y:PARENT_BOTTOM - 45
Width:120 Width:120