Merge pull request #4923 from pchote/td-ui-consistency

TD menu layout improvements.
This commit is contained in:
Matthias Mailänder
2014-03-20 11:36:38 +01:00
5 changed files with 34 additions and 20 deletions

View File

@@ -12,6 +12,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Graphics;
using OpenRA.Network; using OpenRA.Network;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Widgets; using OpenRA.Widgets;
@@ -20,6 +21,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{ {
public class LobbyLogic public class LobbyLogic
{ {
static readonly Action DoNothing = () => { };
readonly Action onStart; readonly Action onStart;
readonly Action onExit; readonly Action onExit;
readonly OrderManager orderManager; readonly OrderManager orderManager;
@@ -86,7 +89,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
} }
[ObjectCreator.UseCtor] [ObjectCreator.UseCtor]
internal LobbyLogic(Widget widget, World world, OrderManager orderManager, internal LobbyLogic(Widget widget, World world, WorldRenderer worldRenderer, OrderManager orderManager,
Action onExit, Action onStart, bool skirmishMode) Action onExit, Action onStart, bool skirmishMode)
{ {
lobby = widget; lobby = widget;
@@ -164,7 +167,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
Ui.OpenWindow("MAPCHOOSER_PANEL", new WidgetArgs() Ui.OpenWindow("MAPCHOOSER_PANEL", new WidgetArgs()
{ {
{ "initialMap", preview.Uid }, { "initialMap", preview.Uid },
{ "onExit", () => { } }, { "onExit", DoNothing },
{ "onSelect", onSelect } { "onSelect", onSelect }
}); });
}; };
@@ -469,9 +472,17 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var musicButton = lobby.GetOrNull<ButtonWidget>("MUSIC_BUTTON"); var musicButton = lobby.GetOrNull<ButtonWidget>("MUSIC_BUTTON");
if (musicButton != null) if (musicButton != null)
musicButton.OnClick = () => Ui.OpenWindow("MUSIC_PANEL", musicButton.OnClick = () => Ui.OpenWindow("MUSIC_PANEL", new WidgetArgs { { "onExit", DoNothing } });
new WidgetArgs { { "onExit", () => { } } });
var settingsButton = lobby.GetOrNull<ButtonWidget>("SETTINGS_BUTTON");
if (settingsButton != null)
{
settingsButton.OnClick = () => Ui.OpenWindow("SETTINGS_PANEL", new WidgetArgs
{
{ "onExit", DoNothing },
{ "worldRenderer", worldRenderer }
});
}
// Add a bot on the first lobbyinfo update // Add a bot on the first lobbyinfo update
if (this.skirmishMode) if (this.skirmishMode)
Game.LobbyInfoChanged += WidgetUtils.Once(() => Game.LobbyInfoChanged += WidgetUtils.Once(() =>

View File

@@ -186,7 +186,6 @@ Container@ASSETBROWSER_PANEL:
Align:Left Align:Left
Button@CLOSE_BUTTON: Button@CLOSE_BUTTON:
Key:escape Key:escape
X:PARENT_RIGHT-140
Y:434 Y:434
Width:140 Width:140
Height:35 Height:35

View File

@@ -28,7 +28,6 @@ Container@CREDITS_PANEL:
Height:16 Height:16
VAlign:Top VAlign:Top
Button@BACK_BUTTON: Button@BACK_BUTTON:
X:PARENT_RIGHT-140
Y:399 Y:399
Width:140 Width:140
Height:35 Height:35

View File

@@ -156,14 +156,19 @@ Container@SERVER_LOBBY:
Align:Right Align:Right
Text:Chat: Text:Chat:
Button@DISCONNECT_BUTTON: Button@DISCONNECT_BUTTON:
X:600
Y:499 Y:499
Width:140 Width:140
Height:35 Height:35
Text:Leave Game Text:Leave Game
Key: escape Key: escape
Button@SETTINGS_BUTTON:
X:150
Y:499
Width:140
Height:35
Text:Settings
Button@MUSIC_BUTTON: Button@MUSIC_BUTTON:
X:450 X:300
Y:499 Y:499
Width:140 Width:140
Height:35 Height:35

View File

@@ -33,18 +33,6 @@ Container@SETTINGS_PANEL:
Width:140 Width:140
Height:35 Height:35
Text:Advanced Text:Advanced
Button@RESET_BUTTON:
Y:343
Width:140
Height:35
Text:Reset
Button@BACK_BUTTON:
Key:escape
X:PARENT_RIGHT-WIDTH
Y:343
Width:140
Height:35
Text:Back
Background@bg: Background@bg:
Y:34 Y:34
Width:590 Width:590
@@ -454,3 +442,15 @@ Container@SETTINGS_PANEL:
Height:20 Height:20
Font:Regular Font:Regular
Text:Check Sync around Unsynced Code Text:Check Sync around Unsynced Code
Button@BACK_BUTTON:
Key:escape
Y:343
Width:140
Height:35
Text:Back
Button@RESET_BUTTON:
X:150
Y:343
Width:140
Height:35
Text:Reset