diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
index 6178e15039..ab9e24027a 100644
--- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
+++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
@@ -361,6 +361,7 @@
+
diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs
index 2bb180808c..17aac42fe2 100644
--- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs
+++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs
@@ -400,106 +400,4 @@ namespace OpenRA.Mods.RA.Widgets.Logic
orderManager.IssueOrder(Order.Command("ready"));
}
}
-
- public static class LobbyUtils
- {
- public static void SetupNameWidget(OrderManager orderManager, Session.Client c, TextFieldWidget name)
- {
- name.Text = c.Name;
- name.OnEnterKey = () =>
- {
- name.Text = name.Text.Trim();
- if (name.Text.Length == 0)
- name.Text = c.Name;
-
- name.LoseFocus();
- if (name.Text == c.Name)
- return true;
-
- orderManager.IssueOrder(Order.Command("name " + name.Text));
- Game.Settings.Player.Name = name.Text;
- Game.Settings.Save();
- return true;
- };
- name.OnLoseFocus = () => name.OnEnterKey();
- }
-
- class SlotDropDownOption
- {
- public string Title;
- public string Order;
- public Func Selected;
-
- public SlotDropDownOption(string title, string order, Func selected)
- {
- Title = title;
- Order = order;
- Selected = selected;
- }
- }
-
- public static void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot,
- Session.Client client, OrderManager orderManager)
- {
- var options = new List()
- {
- new SlotDropDownOption("Open", "slot_open "+slot.PlayerReference, () => (!slot.Closed && client == null)),
- new SlotDropDownOption("Closed", "slot_close "+slot.PlayerReference, () => slot.Closed)
- };
-
- if (slot.AllowBots)
- foreach (var b in Rules.Info["player"].Traits.WithInterface().Select(t => t.Name))
- {
- var bot = b;
- options.Add(new SlotDropDownOption("Bot: {0}".F(bot),
- "slot_bot {0} {1}".F(slot.PlayerReference, bot),
- () => client != null && client.Bot == bot));
- }
-
- Func setupItem = (o, itemTemplate) =>
- {
- var item = ScrollItemWidget.Setup(itemTemplate,
- o.Selected,
- () => orderManager.IssueOrder(Order.Command(o.Order)));
- item.GetWidget("LABEL").GetText = () => o.Title;
- return item;
- };
-
- dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 150, options, setupItem);
- }
-
- public static void ShowTeamDropDown(DropDownButtonWidget dropdown, Session.Client client,
- OrderManager orderManager, Map map)
- {
- Func setupItem = (ii, itemTemplate) =>
- {
- var item = ScrollItemWidget.Setup(itemTemplate,
- () => client.Team == ii,
- () => orderManager.IssueOrder(Order.Command("team {0} {1}".F(client.Index, ii))));
- item.GetWidget("LABEL").GetText = () => ii == 0 ? "-" : ii.ToString();
- return item;
- };
-
- var options = Graphics.Util.MakeArray(map.SpawnPoints.Count() + 1, i => i).ToList();
- dropdown.ShowDropDown("TEAM_DROPDOWN_TEMPLATE", 150, options, setupItem);
- }
-
- public static void ShowRaceDropDown(DropDownButtonWidget dropdown, Session.Client client,
- OrderManager orderManager, Dictionary countryNames)
- {
- Func setupItem = (race, itemTemplate) =>
- {
- var item = ScrollItemWidget.Setup(itemTemplate,
- () => client.Country == race,
- () => orderManager.IssueOrder(Order.Command("race {0} {1}".F(client.Index, race))));
- item.GetWidget("LABEL").GetText = () => countryNames[race];
- var flag = item.GetWidget("FLAG");
- flag.GetImageCollection = () => "flags";
- flag.GetImageName = () => race;
- return item;
- };
-
- dropdown.ShowDropDown("RACE_DROPDOWN_TEMPLATE", 150, countryNames.Keys.ToList(), setupItem);
- }
- }
}
diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs
new file mode 100644
index 0000000000..c5a7150ef7
--- /dev/null
+++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs
@@ -0,0 +1,122 @@
+#region Copyright & License Information
+/*
+ * Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
+ * This file is part of OpenRA, which is free software. It is made
+ * available to you under the terms of the GNU General Public License
+ * as published by the Free Software Foundation. For more information,
+ * see COPYING.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using OpenRA.Network;
+using OpenRA.Traits;
+using OpenRA.Widgets;
+
+namespace OpenRA.Mods.RA.Widgets.Logic
+{
+ public static class LobbyUtils
+ {
+ public static void SetupNameWidget(OrderManager orderManager, Session.Client c, TextFieldWidget name)
+ {
+ name.Text = c.Name;
+ name.OnEnterKey = () =>
+ {
+ name.Text = name.Text.Trim();
+ if (name.Text.Length == 0)
+ name.Text = c.Name;
+
+ name.LoseFocus();
+ if (name.Text == c.Name)
+ return true;
+
+ orderManager.IssueOrder(Order.Command("name " + name.Text));
+ Game.Settings.Player.Name = name.Text;
+ Game.Settings.Save();
+ return true;
+ };
+ name.OnLoseFocus = () => name.OnEnterKey();
+ }
+
+ class SlotDropDownOption
+ {
+ public string Title;
+ public string Order;
+ public Func Selected;
+
+ public SlotDropDownOption(string title, string order, Func selected)
+ {
+ Title = title;
+ Order = order;
+ Selected = selected;
+ }
+ }
+
+ public static void ShowSlotDropDown(DropDownButtonWidget dropdown, Session.Slot slot,
+ Session.Client client, OrderManager orderManager)
+ {
+ var options = new List()
+ {
+ new SlotDropDownOption("Open", "slot_open "+slot.PlayerReference, () => (!slot.Closed && client == null)),
+ new SlotDropDownOption("Closed", "slot_close "+slot.PlayerReference, () => slot.Closed)
+ };
+
+ if (slot.AllowBots)
+ foreach (var b in Rules.Info["player"].Traits.WithInterface().Select(t => t.Name))
+ {
+ var bot = b;
+ options.Add(new SlotDropDownOption("Bot: {0}".F(bot),
+ "slot_bot {0} {1}".F(slot.PlayerReference, bot),
+ () => client != null && client.Bot == bot));
+ }
+
+ Func setupItem = (o, itemTemplate) =>
+ {
+ var item = ScrollItemWidget.Setup(itemTemplate,
+ o.Selected,
+ () => orderManager.IssueOrder(Order.Command(o.Order)));
+ item.GetWidget("LABEL").GetText = () => o.Title;
+ return item;
+ };
+
+ dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 150, options, setupItem);
+ }
+
+ public static void ShowTeamDropDown(DropDownButtonWidget dropdown, Session.Client client,
+ OrderManager orderManager, Map map)
+ {
+ Func setupItem = (ii, itemTemplate) =>
+ {
+ var item = ScrollItemWidget.Setup(itemTemplate,
+ () => client.Team == ii,
+ () => orderManager.IssueOrder(Order.Command("team {0} {1}".F(client.Index, ii))));
+ item.GetWidget("LABEL").GetText = () => ii == 0 ? "-" : ii.ToString();
+ return item;
+ };
+
+ var options = Graphics.Util.MakeArray(map.SpawnPoints.Count() + 1, i => i).ToList();
+ dropdown.ShowDropDown("TEAM_DROPDOWN_TEMPLATE", 150, options, setupItem);
+ }
+
+ public static void ShowRaceDropDown(DropDownButtonWidget dropdown, Session.Client client,
+ OrderManager orderManager, Dictionary countryNames)
+ {
+ Func setupItem = (race, itemTemplate) =>
+ {
+ var item = ScrollItemWidget.Setup(itemTemplate,
+ () => client.Country == race,
+ () => orderManager.IssueOrder(Order.Command("race {0} {1}".F(client.Index, race))));
+ item.GetWidget("LABEL").GetText = () => countryNames[race];
+ var flag = item.GetWidget("FLAG");
+ flag.GetImageCollection = () => "flags";
+ flag.GetImageName = () => race;
+ return item;
+ };
+
+ dropdown.ShowDropDown("RACE_DROPDOWN_TEMPLATE", 150, countryNames.Keys.ToList(), setupItem);
+ }
+ }
+}