From 0ad9e655770e7f4e11067a80f06e83d418416692 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 30 Jun 2013 12:29:52 +1200 Subject: [PATCH 1/4] Add group labels to the slots dropdown. --- OpenRA.Game/Widgets/DropDownButtonWidget.cs | 35 +++++++++++++++++++++ OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs | 12 ++++--- mods/cnc/chrome/dialogs.yaml | 12 +++++++ mods/ra/chrome/dropdowns.yaml | 12 +++++++ 4 files changed, 67 insertions(+), 4 deletions(-) diff --git a/OpenRA.Game/Widgets/DropDownButtonWidget.cs b/OpenRA.Game/Widgets/DropDownButtonWidget.cs index 4bd5ef4e3b..dff82bafd1 100644 --- a/OpenRA.Game/Widgets/DropDownButtonWidget.cs +++ b/OpenRA.Game/Widgets/DropDownButtonWidget.cs @@ -105,6 +105,41 @@ namespace OpenRA.Widgets panel.Bounds.Height = Math.Min(height, panel.ContentHeight); AttachPanel(panel); } + + public void ShowDropDown(string panelTemplate, int height, Dictionary> groups, Func setupItem) + { + var substitutions = new Dictionary() {{ "DROPDOWN_WIDTH", Bounds.Width }}; + var panel = (ScrollPanelWidget)Ui.LoadWidget(panelTemplate, null, new WidgetArgs() + {{ "substitutions", substitutions }}); + + var headerTemplate = panel.Get("HEADER"); + var itemTemplate = panel.Get("TEMPLATE"); + panel.RemoveChildren(); + + foreach (var kv in groups) + { + var group = kv.Key; + if (group.Length > 0) + { + var header = ScrollItemWidget.Setup(headerTemplate, () => true, () => {}); + header.Get("LABEL").GetText = () => group; + panel.AddChild(header); + } + + foreach (var option in kv.Value) + { + var o = option; + + var item = setupItem(o, itemTemplate); + var onClick = item.OnClick; + item.OnClick = () => { onClick(); RemovePanel(); }; + + panel.AddChild(item); + } + } + panel.Bounds.Height = Math.Min(height, panel.ContentHeight); + AttachPanel(panel); + } } public class MaskWidget : Widget diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs index 87a26b9e9f..71453508d3 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs @@ -38,21 +38,25 @@ namespace OpenRA.Mods.RA.Widgets.Logic public static void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot, Session.Client client, OrderManager orderManager) { - var options = new List() + var options = new Dictionary>() {{"Slot", new List() { new SlotDropDownOption("Open", "slot_open "+slot.PlayerReference, () => (!slot.Closed && client == null)), new SlotDropDownOption("Closed", "slot_close "+slot.PlayerReference, () => slot.Closed) - }; + }}}; + var bots = new List(); if (slot.AllowBots) + { foreach (var b in Rules.Info["player"].Traits.WithInterface().Select(t => t.Name)) { var bot = b; var botController = orderManager.LobbyInfo.Clients.Where(c => c.IsAdmin).FirstOrDefault(); - options.Add(new SlotDropDownOption("Bot: {0}".F(bot), + bots.Add(new SlotDropDownOption(bot, "slot_bot {0} {1} {2}".F(slot.PlayerReference, botController.Index, bot), () => client != null && client.Bot == bot)); } + } + options.Add(bots.Any() ? "Bots" : "Bots Disabled", bots); Func setupItem = (o, itemTemplate) => { @@ -63,7 +67,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic return item; }; - dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 150, options, setupItem); + dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 167, options, setupItem); } public static void ShowTeamDropDown(DropDownButtonWidget dropdown, Session.Client client, diff --git a/mods/cnc/chrome/dialogs.yaml b/mods/cnc/chrome/dialogs.yaml index 6396f33257..ed82c9db78 100644 --- a/mods/cnc/chrome/dialogs.yaml +++ b/mods/cnc/chrome/dialogs.yaml @@ -46,6 +46,18 @@ ScrollPanel@LABEL_DROPDOWN_TEMPLATE: Width:DROPDOWN_WIDTH Background:panel-black Children: + ScrollItem@HEADER: + Width:PARENT_RIGHT-27 + Height:13 + X:2 + Y:0 + Visible:false + Children: + Label@LABEL: + Font:TinyBold + Width:PARENT_RIGHT + Height:10 + Align:Center ScrollItem@TEMPLATE: Width:PARENT_RIGHT-27 Height:25 diff --git a/mods/ra/chrome/dropdowns.yaml b/mods/ra/chrome/dropdowns.yaml index aa008a81a4..2c5289aa72 100644 --- a/mods/ra/chrome/dropdowns.yaml +++ b/mods/ra/chrome/dropdowns.yaml @@ -1,6 +1,18 @@ ScrollPanel@LABEL_DROPDOWN_TEMPLATE: Width:DROPDOWN_WIDTH Children: + ScrollItem@HEADER: + Width:PARENT_RIGHT-27 + Height:13 + X:2 + Y:0 + Visible:false + Children: + Label@LABEL: + Font:TinyBold + Width:PARENT_RIGHT + Height:10 + Align:Center ScrollItem@TEMPLATE: Width:PARENT_RIGHT-27 Height:25 From a49bf40413e37d1d53b36321b76c452a3af0cd3b Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 30 Jun 2013 13:31:55 +1200 Subject: [PATCH 2/4] Replace add bots / assign with a combined slot options dropdown. --- OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs | 51 +++++------- OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs | 88 ++++++++++++++------ mods/cnc/chrome/lobby.yaml | 31 +++---- mods/ra/chrome/lobby.yaml | 12 +-- 4 files changed, 94 insertions(+), 88 deletions(-) diff --git a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs index 8b3de02d03..67a10b0a20 100644 --- a/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs +++ b/OpenRA.Mods.RA/ServerTraits/LobbyCommands.cs @@ -335,46 +335,35 @@ namespace OpenRA.Mods.RA.Server return true; } - int teams; - if (!int.TryParse(s, out teams)) + int teamCount; + if (!int.TryParse(s, out teamCount)) { server.SendOrderTo(conn, "Message", "Number of teams could not be parsed: {0}".F(s)); return true; } - teams = teams.Clamp(1, 8); + var maxTeams = (server.lobbyInfo.Clients.Count(c => c.Slot != null) + 1) / 2; + teamCount = teamCount.Clamp(0, maxTeams); var players = server.lobbyInfo.Slots - .Select(slot => server.lobbyInfo.Clients.SingleOrDefault(c => c.Slot == slot.Key)) - .Where(c => c != null && !server.lobbyInfo.Slots[c.Slot].LockTeam).ToArray(); - if (players.Length < 2) + .Select(slot => server.lobbyInfo.ClientInSlot(slot.Key)) + .Where(c => c != null && !server.lobbyInfo.Slots[c.Slot].LockTeam); + + var assigned = 0; + var playerCount = players.Count(); + foreach (var player in players) { - server.SendOrderTo(conn, "Message", "Not enough players to assign teams"); - return true; - } - if (teams > players.Length) - { - server.SendOrderTo(conn, "Message", "Too many teams for the number of players"); - return true; + // Free for all + if (teamCount == 0) + player.Team = 0; + + // Humans vs Bots + else if (teamCount == 1) + player.Team = player.Bot == null ? 1 : 2; + + else + player.Team = assigned++ * teamCount / playerCount + 1; } - var teamSizes = new int[players.Length]; - for (var i = 0; i < players.Length; i++) - teamSizes[i % teams]++; - - var playerIndex = 0; - for (var team = 1; team <= teams; team++) - { - for (var teamPlayerIndex = 0; teamPlayerIndex < teamSizes[team - 1]; playerIndex++, teamPlayerIndex++) - { - var cl = players[playerIndex]; - if (cl.Bot == null) - cl.State = Session.ClientState.NotReady; - cl.Team = team; - } - } - // All vs Host - if (teams == 1) - client.Team = 2; server.SyncLobbyInfo(); return true; }}, diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index 98bf8efa85..1a36f38529 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -165,49 +165,83 @@ namespace OpenRA.Mods.RA.Widgets.Logic }; mapButton.IsVisible = () => mapButton.Visible && Game.IsHost; - var assignTeams = lobby.GetOrNull("ASSIGNTEAMS_DROPDOWNBUTTON"); - if (assignTeams != null) + var slotsButton = lobby.GetOrNull("SLOTS_DROPDOWNBUTTON"); + if (slotsButton != null) { - assignTeams.IsVisible = () => Game.IsHost; - assignTeams.IsDisabled = () => gameStarting || orderManager.LobbyInfo.Clients.Count(c => c.Slot != null) < 2 - || orderManager.LocalClient == null || orderManager.LocalClient.IsReady; + slotsButton.IsDisabled = () => !Game.IsHost || gameStarting || orderManager.LocalClient == null || + orderManager.LocalClient.IsReady || !orderManager.LobbyInfo.Slots.Values.Any(s => s.AllowBots || !s.LockTeam); - assignTeams.OnMouseDown = _ => + var aiModes = Rules.Info["player"].Traits.WithInterface().Select(t => t.Name); + slotsButton.OnMouseDown = _ => { - var options = Enumerable.Range(1, orderManager.LobbyInfo.Clients.Count(c => c.Slot != null).Clamp(1, 8) - 1).Select(d => new DropDownOption + var options = new Dictionary>(); + + var botController = orderManager.LobbyInfo.Clients.Where(c => c.IsAdmin).FirstOrDefault(); + if (orderManager.LobbyInfo.Slots.Values.Any(s => s.AllowBots)) { - Title = (d == 1 ? "All vs Host" : "{0} Teams".F(d)), - IsSelected = () => false, - OnClick = () => orderManager.IssueOrder(Order.Command("assignteams {0}".F(d.ToString()))) - }); + var botOptions = new List(){ new DropDownOption() + { + Title = "Add", + IsSelected = () => false, + OnClick = () => + { + foreach (var slot in orderManager.LobbyInfo.Slots) + { + var bot = aiModes.Random(Game.CosmeticRandom); + var c = orderManager.LobbyInfo.ClientInSlot(slot.Key); + if (slot.Value.AllowBots == true && (c == null || c.Bot != null)) + orderManager.IssueOrder(Order.Command("slot_bot {0} {1} {2}".F(slot.Key, botController.Index, bot))); + } + } + }}; + + if (orderManager.LobbyInfo.Clients.Any(c => c.Bot != null)) + { + botOptions.Add(new DropDownOption() + { + Title = "Remove", + IsSelected = () => false, + OnClick = () => + { + foreach (var slot in orderManager.LobbyInfo.Slots) + { + var c = orderManager.LobbyInfo.ClientInSlot(slot.Key); + if (c != null && c.Bot != null) + orderManager.IssueOrder(Order.Command("slot_open "+slot.Value.PlayerReference)); + } + } + }); + } + + options.Add("Bots", botOptions); + } + + var teamCount = (orderManager.LobbyInfo.Slots.Count(s => !s.Value.LockTeam && orderManager.LobbyInfo.ClientInSlot(s.Key) != null) + 1) / 2; + if (teamCount >= 1) + { + var teamOptions = Enumerable.Range(0, teamCount + 1).Reverse().Select(d => new DropDownOption + { + Title = (d > 1 ? "{0} Teams".F(d) : d == 1 ? "Humans vs Bots" : "Free for all"), + IsSelected = () => false, + OnClick = () => orderManager.IssueOrder(Order.Command("assignteams {0}".F(d.ToString()))) + }); + + options.Add("Teams", teamOptions); + } + Func setupItem = (option, template) => { var item = ScrollItemWidget.Setup(template, option.IsSelected, option.OnClick); item.Get("LABEL").GetText = () => option.Title; return item; }; - assignTeams.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", options.Count() * 30, options, setupItem); + slotsButton.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 175, options, setupItem); }; } var disconnectButton = lobby.Get("DISCONNECT_BUTTON"); disconnectButton.OnClick = () => { CloseWindow(); onExit(); }; - var addBotsButton = lobby.Get("ADD_BOTS"); - addBotsButton.IsVisible = () => Game.IsHost; - addBotsButton.IsDisabled = () => !Game.IsHost || gameStarting || orderManager.LocalClient == null - || orderManager.LocalClient.IsReady || !orderManager.LobbyInfo.Slots.Values.Any(s => s.AllowBots); - addBotsButton.OnClick = () => { - var aiModes = Rules.Info["player"].Traits.WithInterface().Select(t => t.Name); - foreach (var slot in orderManager.LobbyInfo.Slots) - { - var bot = aiModes.Random(Game.CosmeticRandom); - var c = orderManager.LobbyInfo.ClientInSlot(slot.Key); - if (slot.Value.AllowBots == true && (c == null || c.Bot != null)) - orderManager.IssueOrder(Order.Command("slot_bot {0} {1} {2}".F(slot.Key,0,bot))); - } - }; - var allowCheats = lobby.Get("ALLOWCHEATS_CHECKBOX"); allowCheats.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.AllowCheats; allowCheats.IsDisabled = () => !Game.IsHost || gameStarting || orderManager.LocalClient == null diff --git a/mods/cnc/chrome/lobby.yaml b/mods/cnc/chrome/lobby.yaml index 6b2c34534d..dee972f74b 100644 --- a/mods/cnc/chrome/lobby.yaml +++ b/mods/cnc/chrome/lobby.yaml @@ -94,28 +94,25 @@ Container@SERVER_LOBBY: Y:257 Width:130 Height:20 - Text: Debug Menu + Text:Cheats Checkbox@CRATES_CHECKBOX: - X:160 + X:120 Y:257 Width:80 Height:20 - Text: Crates - Button@ADD_BOTS: - X:398-120-10 + Text:Crates + DropDownButton@SLOTS_DROPDOWNBUTTON: + X:213 Y:255 - Width:120 + Width:150 Height:25 - Text:Add Bots - Font:Bold - DropDownButton@ASSIGNTEAMS_DROPDOWNBUTTON: - X:398 + Text:Slot Options + Button@CHANGEMAP_BUTTON: + X:368 Y:255 - Width:120 + Width:150 Height:25 - Font:Bold - Visible:false - Text:Assign + Text:Change Map ScrollPanel@CHAT_DISPLAY: X:15 Y:285 @@ -170,12 +167,6 @@ Container@SERVER_LOBBY: Width:140 Height:35 Text:Music - Button@CHANGEMAP_BUTTON: - X:450 - Y:499 - Width:140 - Height:35 - Text:Change Map Button@START_GAME_BUTTON: X:600 Y:499 diff --git a/mods/ra/chrome/lobby.yaml b/mods/ra/chrome/lobby.yaml index d5701507ce..29210a6f0e 100644 --- a/mods/ra/chrome/lobby.yaml +++ b/mods/ra/chrome/lobby.yaml @@ -125,21 +125,13 @@ Background@SERVER_LOBBY: Height:25 Text:Change Map Font:Bold - Button@ADD_BOTS: - X:PARENT_RIGHT-154 - Y:PARENT_BOTTOM-(289-25-5) - Width:120 - Height:25 - Text:Add Bots - Font:Bold - DropDownButton@ASSIGNTEAMS_DROPDOWNBUTTON: + DropDownButton@SLOTS_DROPDOWNBUTTON: X:PARENT_RIGHT-154 Y:PARENT_BOTTOM-229 Width:120 Height:25 Font:Bold - Visible:false - Text:Assign + Text:Admin DropDownButton@DIFFICULTY_DROPDOWNBUTTON: X:PARENT_RIGHT-154 Y:PARENT_BOTTOM-199 From 47406d8765161dd5f7158632815d0c97803f4fd8 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 30 Jun 2013 18:20:44 +1200 Subject: [PATCH 3/4] Overhaul lobby layout. --- .../Widgets/Logic/KickClientLogic.cs | 8 +- OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs | 124 +++++++------ OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs | 18 +- mods/cnc/chrome/dialogs.yaml | 50 +++++- mods/cnc/chrome/lobby-playerbin.yaml | 35 ++-- mods/cnc/chrome/lobby.yaml | 45 ++--- mods/d2k/chrome/lobby-playerbin.yaml | 83 +++++---- mods/ra/chrome/dropdowns.yaml | 20 --- mods/ra/chrome/lobby-dialogs.yaml | 48 ++++- mods/ra/chrome/lobby-playerbin.yaml | 75 +++++--- mods/ra/chrome/lobby.yaml | 170 +++++++++--------- 11 files changed, 396 insertions(+), 280 deletions(-) diff --git a/OpenRA.Mods.RA/Widgets/Logic/KickClientLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/KickClientLogic.cs index 6b44eac700..f1f89edef6 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/KickClientLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/KickClientLogic.cs @@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic class KickClientLogic { [ObjectCreator.UseCtor] - public KickClientLogic(Widget widget, string clientName, Action okPressed) + public KickClientLogic(Widget widget, string clientName, Action okPressed, Action cancelPressed) { widget.Get("TITLE").GetText = () => "Kick {0}?".F(clientName); @@ -31,7 +31,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic okPressed(tempBan); }; - widget.Get("CANCEL_BUTTON").OnClick = () => widget.Parent.RemoveChild(widget); + widget.Get("CANCEL_BUTTON").OnClick = () => + { + widget.Parent.RemoveChild(widget); + cancelPressed(); + }; } } } diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index 1a36f38529..c6e024f962 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -20,6 +20,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic { public class LobbyLogic { + enum PanelType { Players, Options, Kick } + PanelType panel = PanelType.Players; + Widget lobby; Widget EditablePlayerTemplate, NonEditablePlayerTemplate, EmptySlotTemplate, EditableSpectatorTemplate, NonEditableSpectatorTemplate, NewSpectatorTemplate; @@ -37,8 +40,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic readonly Action onExit; readonly OrderManager orderManager; - public bool TeamGame; - // Listen for connection failures void ConnectionStateChanged(OrderManager om) { @@ -103,6 +104,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic UpdateCurrentMap(); Players = Ui.LoadWidget("LOBBY_PLAYER_BIN", lobby, new WidgetArgs()); + Players.IsVisible = () => panel == PanelType.Players; + EditablePlayerTemplate = Players.Get("TEMPLATE_EDITABLE_PLAYER"); NonEditablePlayerTemplate = Players.Get("TEMPLATE_NONEDITABLE_PLAYER"); EmptySlotTemplate = Players.Get("TEMPLATE_EMPTY"); @@ -145,31 +148,36 @@ namespace OpenRA.Mods.RA.Widgets.Logic CountryNames.Add("random", "Any"); var gameStarting = false; + Func configurationDisabled = () => !Game.IsHost || gameStarting || panel == PanelType.Kick || + orderManager.LocalClient == null || orderManager.LocalClient.IsReady; - var mapButton = lobby.Get("CHANGEMAP_BUTTON"); - mapButton.OnClick = () => + var mapButton = lobby.GetOrNull("CHANGEMAP_BUTTON"); + if (mapButton != null) { - var onSelect = new Action(m => + mapButton.IsDisabled = configurationDisabled; + mapButton.OnClick = () => { - orderManager.IssueOrder(Order.Command("map " + m.Uid)); - Game.Settings.Server.Map = m.Uid; - Game.Settings.Save(); - }); + var onSelect = new Action(m => + { + orderManager.IssueOrder(Order.Command("map " + m.Uid)); + Game.Settings.Server.Map = m.Uid; + Game.Settings.Save(); + }); - Ui.OpenWindow("MAPCHOOSER_PANEL", new WidgetArgs() - { - { "initialMap", Map.Uid }, - { "onExit", () => {} }, - { "onSelect", onSelect } - }); - }; - mapButton.IsVisible = () => mapButton.Visible && Game.IsHost; + Ui.OpenWindow("MAPCHOOSER_PANEL", new WidgetArgs() + { + { "initialMap", Map.Uid }, + { "onExit", () => {} }, + { "onSelect", onSelect } + }); + }; + } var slotsButton = lobby.GetOrNull("SLOTS_DROPDOWNBUTTON"); if (slotsButton != null) { - slotsButton.IsDisabled = () => !Game.IsHost || gameStarting || orderManager.LocalClient == null || - orderManager.LocalClient.IsReady || !orderManager.LobbyInfo.Slots.Values.Any(s => s.AllowBots || !s.LockTeam); + slotsButton.IsDisabled = () => configurationDisabled() || panel != PanelType.Players || + !orderManager.LobbyInfo.Slots.Values.Any(s => s.AllowBots || !s.LockTeam); var aiModes = Rules.Info["player"].Traits.WithInterface().Select(t => t.Name); slotsButton.OnMouseDown = _ => @@ -213,7 +221,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic }); } - options.Add("Bots", botOptions); + options.Add("Configure Bots", botOptions); } var teamCount = (orderManager.LobbyInfo.Slots.Count(s => !s.Value.LockTeam && orderManager.LobbyInfo.ClientInSlot(s.Key) != null) + 1) / 2; @@ -226,7 +234,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic OnClick = () => orderManager.IssueOrder(Order.Command("assignteams {0}".F(d.ToString()))) }); - options.Add("Teams", teamOptions); + options.Add("Configure Teams", teamOptions); } Func setupItem = (option, template) => @@ -239,42 +247,59 @@ namespace OpenRA.Mods.RA.Widgets.Logic }; } - var disconnectButton = lobby.Get("DISCONNECT_BUTTON"); - disconnectButton.OnClick = () => { CloseWindow(); onExit(); }; + var optionsBin = Ui.LoadWidget("LOBBY_OPTIONS_BIN", lobby, new WidgetArgs()); + optionsBin.IsVisible = () => panel == PanelType.Options; - var allowCheats = lobby.Get("ALLOWCHEATS_CHECKBOX"); - allowCheats.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.AllowCheats; - allowCheats.IsDisabled = () => !Game.IsHost || gameStarting || orderManager.LocalClient == null - || orderManager.LocalClient.IsReady; - allowCheats.OnClick = () => orderManager.IssueOrder(Order.Command( + var optionsButton = lobby.Get("OPTIONS_BUTTON"); + optionsButton.IsDisabled = () => panel == PanelType.Kick; + optionsButton.GetText = () => panel == PanelType.Options ? "Players" : "Options"; + optionsButton.OnClick = () => panel = (panel == PanelType.Options) ? PanelType.Players : PanelType.Options; + + var startGameButton = lobby.GetOrNull("START_GAME_BUTTON"); + if (startGameButton != null) + { + startGameButton.IsDisabled = () => configurationDisabled() || + orderManager.LobbyInfo.Slots.Any(sl => sl.Value.Required && orderManager.LobbyInfo.ClientInSlot(sl.Key) == null); + startGameButton.OnClick = () => + { + gameStarting = true; + orderManager.IssueOrder(Order.Command("startgame")); + }; + } + + // Options panel + var allowCheats = optionsBin.GetOrNull("ALLOWCHEATS_CHECKBOX"); + if (allowCheats != null) + { + allowCheats.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.AllowCheats; + allowCheats.IsDisabled = configurationDisabled; + allowCheats.OnClick = () => orderManager.IssueOrder(Order.Command( "allowcheats {0}".F(!orderManager.LobbyInfo.GlobalSettings.AllowCheats))); + } - var crates = lobby.GetOrNull("CRATES_CHECKBOX"); + var crates = optionsBin.GetOrNull("CRATES_CHECKBOX"); if (crates != null) { crates.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.Crates; - crates.IsDisabled = () => !Game.IsHost || gameStarting || orderManager.LocalClient == null - || orderManager.LocalClient.IsReady; // maybe disable the checkbox if a map forcefully removes CrateDrop? + crates.IsDisabled = configurationDisabled; crates.OnClick = () => orderManager.IssueOrder(Order.Command( "crates {0}".F(!orderManager.LobbyInfo.GlobalSettings.Crates))); } - var fragileAlliance = lobby.GetOrNull("FRAGILEALLIANCES_CHECKBOX"); + var fragileAlliance = optionsBin.GetOrNull("FRAGILEALLIANCES_CHECKBOX"); if (fragileAlliance != null) { fragileAlliance.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.FragileAlliances; - fragileAlliance.IsDisabled = () => !Game.IsHost || gameStarting - || orderManager.LocalClient == null || orderManager.LocalClient.IsReady; + fragileAlliance.IsDisabled = configurationDisabled; fragileAlliance.OnClick = () => orderManager.IssueOrder(Order.Command( "fragilealliance {0}".F(!orderManager.LobbyInfo.GlobalSettings.FragileAlliances))); }; - - var difficulty = lobby.GetOrNull("DIFFICULTY_DROPDOWNBUTTON"); + var difficulty = optionsBin.GetOrNull("DIFFICULTY_DROPDOWNBUTTON"); if (difficulty != null) { difficulty.IsVisible = () => Map != null && Map.Difficulties != null && Map.Difficulties.Any(); - difficulty.IsDisabled = () => !Game.IsHost || gameStarting || orderManager.LocalClient == null || orderManager.LocalClient.IsReady; + difficulty.IsDisabled = configurationDisabled; difficulty.GetText = () => orderManager.LobbyInfo.GlobalSettings.Difficulty; difficulty.OnMouseDown = _ => { @@ -292,17 +317,13 @@ namespace OpenRA.Mods.RA.Widgets.Logic }; difficulty.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", options.Count() * 30, options, setupItem); }; + + var difficultyDesc = optionsBin.GetOrNull("DIFFICULTY_DESC"); + difficultyDesc.IsVisible = difficulty.IsVisible; } - var startGameButton = lobby.Get("START_GAME_BUTTON"); - startGameButton.IsVisible = () => Game.IsHost; - startGameButton.IsDisabled = () => gameStarting - || orderManager.LobbyInfo.Slots.Any(sl => sl.Value.Required && orderManager.LobbyInfo.ClientInSlot(sl.Key) == null); - startGameButton.OnClick = () => - { - gameStarting = true; - orderManager.IssueOrder(Order.Command("startgame")); - }; + var disconnectButton = lobby.Get("DISCONNECT_BUTTON"); + disconnectButton.OnClick = () => { CloseWindow(); onExit(); }; bool teamChat = false; var chatLabel = lobby.Get("LABEL_CHATTYPE"); @@ -401,8 +422,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic void UpdatePlayerList() { var idx = 0; - TeamGame = false; - foreach (var kv in orderManager.LobbyInfo.Slots) { var key = kv.Key; @@ -449,9 +468,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic LobbyUtils.SetupEditableFactionWidget(template, slot, client, orderManager, CountryNames); LobbyUtils.SetupEditableTeamWidget(template, slot, client, orderManager, Map.GetSpawnPoints().Length); LobbyUtils.SetupEditableReadyWidget(template, slot, client, orderManager); - - if (slot.LockTeam || client.Team > 0) - TeamGame = true; } else { // Non-editable player in slot @@ -460,7 +476,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic LobbyUtils.SetupClientWidget(template, slot, client, orderManager, client.Bot == null); LobbyUtils.SetupNameWidget(template, slot, client); - LobbyUtils.SetupKickWidget(template, slot, client, orderManager, lobby); + LobbyUtils.SetupKickWidget(template, slot, client, orderManager, lobby, + () => panel = PanelType.Kick, () => panel = PanelType.Players); LobbyUtils.SetupColorWidget(template, slot, client); LobbyUtils.SetupFactionWidget(template, slot, client, CountryNames); LobbyUtils.SetupTeamWidget(template, slot, client); @@ -502,7 +519,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic template = NonEditableSpectatorTemplate.Clone(); LobbyUtils.SetupNameWidget(template, null, client); - LobbyUtils.SetupKickWidget(template, null, client, orderManager, lobby); + LobbyUtils.SetupKickWidget(template, null, client, orderManager, lobby, + () => panel = PanelType.Kick, () => panel = PanelType.Players); } LobbyUtils.SetupClientWidget(template, null, c, orderManager, true); diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs index 71453508d3..23fe2e70a9 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs @@ -266,17 +266,23 @@ namespace OpenRA.Mods.RA.Widgets.Logic slot.IsVisible = () => false; } - public static void SetupKickWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, Widget lobby) + public static void SetupKickWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, Widget lobby, Action before, Action after) { var button = parent.Get("KICK"); button.IsVisible = () => Game.IsHost && c.Index != orderManager.LocalClient.Index; button.IsDisabled = () => orderManager.LocalClient.IsReady; - Action okPressed = tempBan => orderManager.IssueOrder(Order.Command("kick {0} {1}".F(c.Index, tempBan))); - button.OnClick = () => Game.LoadWidget(null, "KICK_CLIENT_DIALOG", lobby, new WidgetArgs + Action okPressed = tempBan => { orderManager.IssueOrder(Order.Command("kick {0} {1}".F(c.Index, tempBan))); after(); }; + button.OnClick = () => { - { "clientName", c.Name }, - { "okPressed", okPressed } - }); + before(); + + Game.LoadWidget(null, "KICK_CLIENT_DIALOG", lobby, new WidgetArgs + { + { "clientName", c.Name }, + { "okPressed", okPressed }, + { "cancelPressed", after } + }); + }; } public static void SetupEditableColorWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, ColorPreviewManagerWidget colorPreview) diff --git a/mods/cnc/chrome/dialogs.yaml b/mods/cnc/chrome/dialogs.yaml index ed82c9db78..955cc9f069 100644 --- a/mods/cnc/chrome/dialogs.yaml +++ b/mods/cnc/chrome/dialogs.yaml @@ -148,10 +148,10 @@ Container@CONFIRM_PROMPT: Background@KICK_CLIENT_DIALOG: X:15 Y:30 - Width:503 + Width:501 Height:219 Logic:KickClientLogic - Background:panel-black + Background:scrollpanel-bg Children: Label@TITLE: X:0 @@ -195,4 +195,50 @@ Background@KICK_CLIENT_DIALOG: Width:120 Height:25 Text:Cancel + Font:Bold + +Background@LOBBY_OPTIONS_BIN: + X:15 + Y:30 + Width:501 + Height:219 + Background:scrollpanel-bg + Children: + Label@TITLE: + X:0 + Y:50 + Width:PARENT_RIGHT + Height:25 + Font:Bold + Align:Center + Text: Map Options + Checkbox@ALLOWCHEATS_CHECKBOX: + X:150 + Y:80 + Width:80 + Height:20 + Text:Enable Cheats / Debug Menu + Checkbox@CRATES_CHECKBOX: + X:150 + Y:110 + Width:80 + Height:20 + Text:Enable Crates + Checkbox@FRAGILEALLIANCES_CHECKBOX: + X:150 + Y:140 + Width:80 + Height:20 + Text:Allow Team Changes + Label@DIFFICULTY_DESC: + X:150 + Y:170 + Width:120 + Height:25 + Text:Mission Difficulty: + DropDownButton@DIFFICULTY_DROPDOWNBUTTON: + X:265 + Y:170 + Width:100 + Height:25 Font:Bold \ No newline at end of file diff --git a/mods/cnc/chrome/lobby-playerbin.yaml b/mods/cnc/chrome/lobby-playerbin.yaml index bae503c45f..83c877e61d 100644 --- a/mods/cnc/chrome/lobby-playerbin.yaml +++ b/mods/cnc/chrome/lobby-playerbin.yaml @@ -1,9 +1,9 @@ ScrollPanel@LOBBY_PLAYER_BIN: X:15 Y:30 - Width:503 - ItemSpacing:5 + Width:501 Height:219 + ItemSpacing:5 Children: Container@TEMPLATE_EDITABLE_PLAYER: X:5 @@ -94,7 +94,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: ImageName:checked Checkbox@STATUS_CHECKBOX: Visible:false - X:448 + X:446 Y:2 Width:20 Height:20 @@ -129,11 +129,10 @@ ScrollPanel@LOBBY_PLAYER_BIN: Width:11 Height:25 Label@NAME: - Text:Name - Width:185 - Height:25 - X:15 + X:20 Y:0-1 + Width:180 + Height:25 Button@KICK: Width:25 Height:25 @@ -174,7 +173,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Y:0 Image@STATUS_IMAGE: Visible:false - X:450 + X:448 Y:4 Width:20 Height:20 @@ -195,16 +194,15 @@ ScrollPanel@LOBBY_PLAYER_BIN: Font:Regular Visible:false Label@NAME: - Text:Name - Width:200 - Height:25 - X:15 + X:20 Y:0-1 + Width:195 + Height:25 Visible:false Button@JOIN: Text:Play in this slot Font:Regular - Width:315-55 + Width:257 Height:25 X:210 Y:0 @@ -283,11 +281,10 @@ ScrollPanel@LOBBY_PLAYER_BIN: Width:11 Height:25 Label@NAME: - Text:Name - Width:185 - Height:25 - X:15 + X:20 Y:0-1 + Width:180 + Height:25 Button@KICK: Text:X Width:25 @@ -306,14 +303,14 @@ ScrollPanel@LOBBY_PLAYER_BIN: Container@TEMPLATE_NEW_SPECTATOR: X:5 Y:0 - Width:475 + Width:474 Height:25 Visible:false Children: Button@SPECTATE: Text:Spectate Font:Regular - Width:455 + Width:453 Height:25 X:15 Y:0 \ No newline at end of file diff --git a/mods/cnc/chrome/lobby.yaml b/mods/cnc/chrome/lobby.yaml index dee972f74b..0adfa45480 100644 --- a/mods/cnc/chrome/lobby.yaml +++ b/mods/cnc/chrome/lobby.yaml @@ -83,36 +83,35 @@ Container@SERVER_LOBBY: Align:Center Font:Bold Label@STATUS: - X:448 + X:446 Width:20 Height:25 Text:Ready Align:Left Font:Bold - Checkbox@ALLOWCHEATS_CHECKBOX: + Button@OPTIONS_BUTTON: X:15 - Y:257 - Width:130 - Height:20 - Text:Cheats - Checkbox@CRATES_CHECKBOX: - X:120 - Y:257 - Width:80 - Height:20 - Text:Crates + Y:254 + Width:112 + Height:25 DropDownButton@SLOTS_DROPDOWNBUTTON: - X:213 - Y:255 + X:132 + Y:254 Width:150 Height:25 - Text:Slot Options + Text:Slot Admin Button@CHANGEMAP_BUTTON: - X:368 - Y:255 - Width:150 + X:287 + Y:254 + Width:112 Height:25 Text:Change Map + Button@START_GAME_BUTTON: + X:404 + Y:254 + Width:112 + Height:25 + Text:Start Game ScrollPanel@CHAT_DISPLAY: X:15 Y:285 @@ -156,21 +155,15 @@ Container@SERVER_LOBBY: Align:Right Text:Chat: Button@DISCONNECT_BUTTON: - X:0 + X:600 Y:499 Width:140 Height:35 Text:Leave Game Button@MUSIC_BUTTON: - X:150 + X:450 Y:499 Width:140 Height:35 Text:Music - Button@START_GAME_BUTTON: - X:600 - Y:499 - Width:140 - Height:35 - Text:Start Game TooltipContainer@TOOLTIP_CONTAINER: diff --git a/mods/d2k/chrome/lobby-playerbin.yaml b/mods/d2k/chrome/lobby-playerbin.yaml index 023612843c..f64d6ed24f 100644 --- a/mods/d2k/chrome/lobby-playerbin.yaml +++ b/mods/d2k/chrome/lobby-playerbin.yaml @@ -2,7 +2,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: X:20 Y:67 ItemSpacing:5 - Width:504 + Width:535 Height:235 Children: Container@TEMPLATE_EDITABLE_PLAYER: @@ -37,21 +37,20 @@ ScrollPanel@LOBBY_PLAYER_BIN: TextField@NAME: Text:Name X:15 - Width:135 + Width:165 Height:25 MaxLength:16 DropDownButton@SLOT_OPTIONS: Text:Name X:15 - Width:135 + Width:165 Height:25 Font:Regular Visible:false DropDownButton@COLOR: + X:190 Width:80 Height:25 - X:160 - Y:0 Children: ColorBlock@COLORBLOCK: X:5 @@ -59,37 +58,35 @@ ScrollPanel@LOBBY_PLAYER_BIN: Width:PARENT_RIGHT-35 Height:PARENT_BOTTOM-12 DropDownButton@FACTION: + X:280 Width:130 Height:25 - X:250 - Y:0 Children: Image@FACTIONFLAG: Width:23 Height:23 - X:5 + X:4 Y:2 Label@FACTIONNAME: Text:Faction Width:70 Height:25 - X:30 + X:34 Y:0 DropDownButton@TEAM: - Text:Team + X:420 Width:48 Height:25 - X:390 - Y:0 + Text:Team Checkbox@STATUS_CHECKBOX: - X:448 + X:477 Y:2 Width:20 Height:20 Visible:false Image@STATUS_IMAGE: Visible:false - X:450 + X:479 Y:4 Width:20 Height:20 @@ -127,7 +124,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Height:25 Label@NAME: Text:Name - Width:130 + Width:165 Height:25 X:20 Y:0-1 @@ -135,41 +132,41 @@ ScrollPanel@LOBBY_PLAYER_BIN: Text:X Width:25 Height:23 - X:125 + X:155 Y:2 Font:Bold ColorBlock@COLORBLOCK: - X:165 + X:195 Y:6 Width:45 Height:13 Container@FACTION: - Width:130 + Width:160 Height:25 - X:250 + X:280 Y:0 Children: Image@FACTIONFLAG: Width:23 Height:23 - X:5 + X:4 Y:2 Label@FACTIONNAME: Text:Faction Width:60 Height:25 - X:40 + X:34 Y:0 Label@TEAM: Text:Team Width:23 Height:25 Align:Center - X:390 + X:420 Y:0 Image@STATUS_IMAGE: Visible:false - X:450 + X:479 Y:4 Width:20 Height:20 @@ -184,13 +181,13 @@ ScrollPanel@LOBBY_PLAYER_BIN: Children: Label@NAME: Text:Name - Width:130 + Width:165 Height:25 X:20 Y:0-1 DropDownButton@SLOT_OPTIONS: Text:Name - Width:135 + Width:165 Height:25 X:15 Y:0 @@ -199,7 +196,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Text:Play in this slot Width:278 Height:25 - X:160 + X:190 Y:0 Container@TEMPLATE_EDITABLE_SPECTATOR: X:5 @@ -233,14 +230,14 @@ ScrollPanel@LOBBY_PLAYER_BIN: TextField@NAME: Text:Name X:15 - Width:135 + Width:165 Height:25 MaxLength:16 Label@SPECTATOR: Text:Spectator Width:278 Height:25 - X:160 + X:190 Y:0 Align:Center Font:Bold @@ -275,7 +272,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Height:25 Label@NAME: Text:Name - Width:130 + Width:160 Height:25 X:20 Y:0-1 @@ -283,14 +280,14 @@ ScrollPanel@LOBBY_PLAYER_BIN: Text:X Width:25 Height:23 - X:125 + X:155 Y:2 Font:Bold Label@SPECTATOR: Text:Spectator Width:278 Height:25 - X:160 + X:190 Y:0 Align:Center Font:Bold @@ -306,5 +303,25 @@ ScrollPanel@LOBBY_PLAYER_BIN: Font:Regular Width:278 Height:25 - X:160 - Y:0 \ No newline at end of file + X:190 + Y:0 + +ScrollPanel@RACE_DROPDOWN_TEMPLATE: + Width:DROPDOWN_WIDTH + Children: + ScrollItem@TEMPLATE: + Width:PARENT_RIGHT-27 + Height:25 + X:2 + Y:0 + Visible:false + Children: + Image@FLAG: + X:2 + Y:2 + Width:30 + Height:15 + Label@LABEL: + X:30 + Width:70 + Height:25 \ No newline at end of file diff --git a/mods/ra/chrome/dropdowns.yaml b/mods/ra/chrome/dropdowns.yaml index 2c5289aa72..59fdfd9345 100644 --- a/mods/ra/chrome/dropdowns.yaml +++ b/mods/ra/chrome/dropdowns.yaml @@ -25,26 +25,6 @@ ScrollPanel@LABEL_DROPDOWN_TEMPLATE: Width:PARENT_RIGHT-20 Height:25 -ScrollPanel@RACE_DROPDOWN_TEMPLATE: - Width:DROPDOWN_WIDTH - Children: - ScrollItem@TEMPLATE: - Width:PARENT_RIGHT-27 - Height:25 - X:2 - Y:0 - Visible:false - Children: - Image@FLAG: - X:5 - Y:5 - Width:30 - Height:15 - Label@LABEL: - X:40 - Width:60 - Height:25 - ScrollPanel@TEAM_DROPDOWN_TEMPLATE: Width:DROPDOWN_WIDTH Children: diff --git a/mods/ra/chrome/lobby-dialogs.yaml b/mods/ra/chrome/lobby-dialogs.yaml index 1253732b44..550781adb2 100644 --- a/mods/ra/chrome/lobby-dialogs.yaml +++ b/mods/ra/chrome/lobby-dialogs.yaml @@ -1,7 +1,7 @@ Background@KICK_CLIENT_DIALOG: X:20 Y:67 - Width:504 + Width:535 Height:235 Logic:KickClientLogic Background:dialog3 @@ -48,4 +48,50 @@ Background@KICK_CLIENT_DIALOG: Width:120 Height:25 Text:Cancel + Font:Bold + +Background@LOBBY_OPTIONS_BIN: + X:20 + Y:67 + Width:535 + Height:235 + Background:dialog3 + Children: + Label@TITLE: + X:0 + Y:50 + Width:PARENT_RIGHT + Height:25 + Font:Bold + Align:Center + Text: Map Options + Checkbox@ALLOWCHEATS_CHECKBOX: + X:150 + Y:80 + Width:80 + Height:20 + Text:Enable Cheats / Debug Menu + Checkbox@CRATES_CHECKBOX: + X:150 + Y:110 + Width:80 + Height:20 + Text:Enable Crates + Checkbox@FRAGILEALLIANCES_CHECKBOX: + X:150 + Y:140 + Width:80 + Height:20 + Text:Allow Team Changes + Label@DIFFICULTY_DESC: + X:150 + Y:170 + Width:120 + Height:25 + Text:Mission Difficulty: + DropDownButton@DIFFICULTY_DROPDOWNBUTTON: + X:265 + Y:170 + Width:100 + Height:25 Font:Bold \ No newline at end of file diff --git a/mods/ra/chrome/lobby-playerbin.yaml b/mods/ra/chrome/lobby-playerbin.yaml index 39ee1c7128..c6d2c6b88c 100644 --- a/mods/ra/chrome/lobby-playerbin.yaml +++ b/mods/ra/chrome/lobby-playerbin.yaml @@ -2,7 +2,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: X:20 Y:67 ItemSpacing:5 - Width:504 + Width:535 Height:235 Children: Container@TEMPLATE_EDITABLE_PLAYER: @@ -37,21 +37,20 @@ ScrollPanel@LOBBY_PLAYER_BIN: TextField@NAME: Text:Name X:15 - Width:135 + Width:165 Height:25 MaxLength:16 DropDownButton@SLOT_OPTIONS: Text:Name X:15 - Width:135 + Width:165 Height:25 Font:Regular Visible:false DropDownButton@COLOR: + X:190 Width:80 Height:25 - X:160 - Y:0 Children: ColorBlock@COLORBLOCK: X:5 @@ -59,10 +58,9 @@ ScrollPanel@LOBBY_PLAYER_BIN: Width:PARENT_RIGHT-35 Height:PARENT_BOTTOM-12 DropDownButton@FACTION: + X:280 Width:130 Height:25 - X:250 - Y:0 Children: Image@FACTIONFLAG: Width:30 @@ -76,20 +74,19 @@ ScrollPanel@LOBBY_PLAYER_BIN: X:40 Y:0 DropDownButton@TEAM: - Text:Team + X:420 Width:48 Height:25 - X:390 - Y:0 + Text:Team Checkbox@STATUS_CHECKBOX: - X:448 + X:477 Y:2 Width:20 Height:20 Visible:false Image@STATUS_IMAGE: Visible:false - X:450 + X:479 Y:4 Width:20 Height:20 @@ -127,7 +124,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Height:25 Label@NAME: Text:Name - Width:130 + Width:165 Height:25 X:20 Y:0-1 @@ -135,18 +132,18 @@ ScrollPanel@LOBBY_PLAYER_BIN: Text:X Width:25 Height:23 - X:125 + X:155 Y:2 Font:Bold ColorBlock@COLORBLOCK: - X:165 + X:195 Y:6 Width:45 Height:13 Container@FACTION: - Width:130 + Width:160 Height:25 - X:250 + X:280 Y:0 Children: Image@FACTIONFLAG: @@ -165,11 +162,11 @@ ScrollPanel@LOBBY_PLAYER_BIN: Width:23 Height:25 Align:Center - X:390 + X:420 Y:0 Image@STATUS_IMAGE: Visible:false - X:450 + X:479 Y:4 Width:20 Height:20 @@ -184,13 +181,13 @@ ScrollPanel@LOBBY_PLAYER_BIN: Children: Label@NAME: Text:Name - Width:130 + Width:165 Height:25 X:20 Y:0-1 DropDownButton@SLOT_OPTIONS: Text:Name - Width:135 + Width:165 Height:25 X:15 Y:0 @@ -199,7 +196,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Text:Play in this slot Width:278 Height:25 - X:160 + X:190 Y:0 Container@TEMPLATE_EDITABLE_SPECTATOR: X:5 @@ -233,14 +230,14 @@ ScrollPanel@LOBBY_PLAYER_BIN: TextField@NAME: Text:Name X:15 - Width:135 + Width:165 Height:25 MaxLength:16 Label@SPECTATOR: Text:Spectator Width:278 Height:25 - X:160 + X:190 Y:0 Align:Center Font:Bold @@ -275,7 +272,7 @@ ScrollPanel@LOBBY_PLAYER_BIN: Height:25 Label@NAME: Text:Name - Width:130 + Width:160 Height:25 X:20 Y:0-1 @@ -283,14 +280,14 @@ ScrollPanel@LOBBY_PLAYER_BIN: Text:X Width:25 Height:23 - X:125 + X:155 Y:2 Font:Bold Label@SPECTATOR: Text:Spectator Width:278 Height:25 - X:160 + X:190 Y:0 Align:Center Font:Bold @@ -306,5 +303,25 @@ ScrollPanel@LOBBY_PLAYER_BIN: Font:Regular Width:278 Height:25 - X:160 - Y:0 \ No newline at end of file + X:190 + Y:0 + +ScrollPanel@RACE_DROPDOWN_TEMPLATE: + Width:DROPDOWN_WIDTH + Children: + ScrollItem@TEMPLATE: + Width:PARENT_RIGHT-27 + Height:25 + X:2 + Y:0 + Visible:false + Children: + Image@FLAG: + X:5 + Y:5 + Width:30 + Height:15 + Label@LABEL: + X:40 + Width:60 + Height:25 \ No newline at end of file diff --git a/mods/ra/chrome/lobby.yaml b/mods/ra/chrome/lobby.yaml index 29210a6f0e..4d6c820957 100644 --- a/mods/ra/chrome/lobby.yaml +++ b/mods/ra/chrome/lobby.yaml @@ -10,78 +10,115 @@ Background@SERVER_LOBBY: X:0 Y:17 Align:Center - Width:530 + Width:PARENT_RIGHT Height:20 Font:Bold - Label@MAP_TITLE: - X:532 - Y:17 - Align:Center - Width:250 - Height:20 - Font:Bold - Background@LOBBY_MAP_BG: - X:PARENT_RIGHT-268 - Y:50 - Width:252 - Height:252 + Background@MAP_BG: + X:PARENT_RIGHT-20-WIDTH + Y:67 + Width:214 + Height:214 Background:dialog3 Children: MapPreview@MAP_PREVIEW: - X:4 - Y:4 - Width:244 - Height:244 + X:2 + Y:2 + Width:210 + Height:210 TooltipContainer:TOOLTIP_CONTAINER + Label@MAP_TITLE: + X:PARENT_RIGHT-20-WIDTH + Y:282 + Width:214 + Height:25 + Font:Bold + Align:Center + Label@MAP_TYPE: + X:PARENT_RIGHT-20-WIDTH + Y:297 + Width:214 + Height:25 + Font:TinyBold + Align:Center + Label@MAP_AUTHOR: + X:PARENT_RIGHT-20-WIDTH + Y:310 + Width:214 + Height:25 + Font:Tiny + Align:Center Container@LABEL_CONTAINER: X:25 Y:40 Children: Label@LABEL_LOBBY_NAME: - Width:150 - Height:25 X:0 - Y:0 + Width:180 + Height:25 Text:Name Align:Center Font:Bold Label@LABEL_LOBBY_COLOR: + X:190 Width:80 Height:25 - X:160 - Y:0 Text:Color Align:Center Font:Bold Label@LABEL_LOBBY_FACTION: + X:280 Width:130 Height:25 - X:250 - Y:0 Text:Faction Align:Center Font:Bold Label@LABEL_LOBBY_TEAM: + X:420 Width:48 Height:25 - X:390 - Y:0 Text:Team Align:Center Font:Bold Label@LABEL_LOBBY_STATUS: - X:448 - Y:0 + X:477 Width:20 Height:25 Text:Ready Align:Left Font:Bold + DropDownButton@SLOTS_DROPDOWNBUTTON: + X:20 + Y:PARENT_BOTTOM - 291 + Width:151 + Height:25 + Font:Bold + Text:Slot Admin + Button@OPTIONS_BUTTON: + X:178 + Y:PARENT_BOTTOM - 291 + Width:121 + Height:25 + Font:Bold + Text:Game Options + Button@CHANGEMAP_BUTTON: + X:306 + Y:PARENT_BOTTOM - 291 + Width:121 + Height:25 + Text:Change Map + Font:Bold + Button@START_GAME_BUTTON: + X:434 + Y:PARENT_BOTTOM - 291 + Width:121 + Height:25 + Text:Start Game + Font:Bold ScrollPanel@CHAT_DISPLAY: X:20 - Y:PARENT_BOTTOM - 289 - Width:PARENT_RIGHT - 200 - Height:230 + Y:PARENT_BOTTOM - HEIGHT - 52 + Width:760 + Height:210 ItemSpacing:1 Children: Container@CHAT_TEMPLATE: @@ -106,69 +143,24 @@ Background@SERVER_LOBBY: Height:15 WordWrap:true VAlign:Top - Label@LABEL_CHATTYPE: - Width:65 - Height:25 - X:0 - Y:PARENT_BOTTOM - 50 - Text:Chat: - Align:Right TextField@CHAT_TEXTFIELD: - X:70 - Y:PARENT_BOTTOM - 49 - Width:550 + X:20 + Y:PARENT_BOTTOM - HEIGHT - 20 + Width:PARENT_RIGHT - 167 Height:25 - Button@CHANGEMAP_BUTTON: - X:PARENT_RIGHT-154 - Y:PARENT_BOTTOM-289 - Width:120 - Height:25 - Text:Change Map - Font:Bold - DropDownButton@SLOTS_DROPDOWNBUTTON: - X:PARENT_RIGHT-154 - Y:PARENT_BOTTOM-229 - Width:120 - Height:25 - Font:Bold - Text:Admin - DropDownButton@DIFFICULTY_DROPDOWNBUTTON: - X:PARENT_RIGHT-154 - Y:PARENT_BOTTOM-199 - Width:120 - Height:25 - Font:Bold - Visible:false - Checkbox@ALLOWCHEATS_CHECKBOX: - X: PARENT_RIGHT-154 - Y: PARENT_BOTTOM-169 - Width: 80 - Height: 20 - Text: Allow Cheats - Checkbox@CRATES_CHECKBOX: - X: PARENT_RIGHT-154 - Y: PARENT_BOTTOM-144 - Width: 80 - Height: 20 - Text: Crates - Checkbox@FRAGILEALLIANCES_CHECKBOX: - X: PARENT_RIGHT-154 - Y: PARENT_BOTTOM-119 - Width: 80 - Height: 20 - Text: Fragile Alliances + LeftMargin:50 + Children: + Label@LABEL_CHATTYPE: + Y:0-1 + Width:45 + Height:25 + Align:Right + Text:Chat: Button@DISCONNECT_BUTTON: - X:PARENT_RIGHT-154 - Y:PARENT_BOTTOM-94 + X:PARENT_RIGHT - WIDTH - 20 + Y:PARENT_BOTTOM - HEIGHT - 20 Width:120 Height:25 Text:Disconnect Font:Bold - Button@START_GAME_BUTTON: - X:PARENT_RIGHT-154 - Y:PARENT_BOTTOM-49 - Width:120 - Height:25 - Text:Start Game - Font:Bold TooltipContainer@TOOLTIP_CONTAINER: \ No newline at end of file From c4190167ee777331b83ebda05285f23ba0db09d9 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 30 Jun 2013 21:40:37 +1200 Subject: [PATCH 4/4] Root the player bin in the lobby ui correctly. Fixes #3505. --- OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs | 2 +- mods/cnc/chrome/lobby.yaml | 1 + mods/ra/chrome/lobby.yaml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index c6e024f962..46670340cc 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -103,7 +103,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic name.GetText = () => orderManager.LobbyInfo.GlobalSettings.ServerName; UpdateCurrentMap(); - Players = Ui.LoadWidget("LOBBY_PLAYER_BIN", lobby, new WidgetArgs()); + Players = Ui.LoadWidget("LOBBY_PLAYER_BIN", lobby.Get("PLAYER_BIN_ROOT"), new WidgetArgs()); Players.IsVisible = () => panel == PanelType.Players; EditablePlayerTemplate = Players.Get("TEMPLATE_EDITABLE_PLAYER"); diff --git a/mods/cnc/chrome/lobby.yaml b/mods/cnc/chrome/lobby.yaml index 0adfa45480..dc543ff7e8 100644 --- a/mods/cnc/chrome/lobby.yaml +++ b/mods/cnc/chrome/lobby.yaml @@ -89,6 +89,7 @@ Container@SERVER_LOBBY: Text:Ready Align:Left Font:Bold + Container@PLAYER_BIN_ROOT: Button@OPTIONS_BUTTON: X:15 Y:254 diff --git a/mods/ra/chrome/lobby.yaml b/mods/ra/chrome/lobby.yaml index 4d6c820957..c85925b232 100644 --- a/mods/ra/chrome/lobby.yaml +++ b/mods/ra/chrome/lobby.yaml @@ -86,6 +86,7 @@ Background@SERVER_LOBBY: Text:Ready Align:Left Font:Bold + Container@PLAYER_BIN_ROOT: DropDownButton@SLOTS_DROPDOWNBUTTON: X:20 Y:PARENT_BOTTOM - 291