Reorganize map options panel.

This commit is contained in:
Paul Chote
2013-08-17 11:17:58 +12:00
parent d76a8c2950
commit 059c88ca1b
5 changed files with 127 additions and 114 deletions

View File

@@ -446,7 +446,7 @@ namespace OpenRA.Mods.RA.Server
return true;
}
if ((server.Map.Options.Difficulties == null && s != null) || (server.Map.Options.Difficulties != null && !server.Map.Options.Difficulties.Contains(s)))
if (s != null && !server.Map.Options.Difficulties.Contains(s))
{
server.SendOrderTo(conn, "Message", "Unsupported difficulty selected: {0}".F(s));
server.SendOrderTo(conn, "Message", "Supported difficulties: {0}".F(server.Map.Options.Difficulties.JoinWith(",")));
@@ -674,12 +674,14 @@ namespace OpenRA.Mods.RA.Server
static void SetDefaultDifficulty(S server)
{
if (server.Map.Options.Difficulties != null && server.Map.Options.Difficulties.Any())
if (!server.Map.Options.Difficulties.Any())
{
if (!server.Map.Options.Difficulties.Contains(server.lobbyInfo.GlobalSettings.Difficulty))
server.lobbyInfo.GlobalSettings.Difficulty = server.Map.Options.Difficulties.First();
server.lobbyInfo.GlobalSettings.Difficulty = null;
return;
}
else server.lobbyInfo.GlobalSettings.Difficulty = null;
if (!server.Map.Options.Difficulties.Contains(server.lobbyInfo.GlobalSettings.Difficulty))
server.lobbyInfo.GlobalSettings.Difficulty = server.Map.Options.Difficulties.First();
}
}
}

View File

@@ -298,7 +298,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var difficulty = optionsBin.GetOrNull<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
if (difficulty != null)
{
difficulty.IsVisible = () => Map.Options.Difficulties != null && Map.Options.Difficulties.Any();
difficulty.IsVisible = () => Map.Options.Difficulties.Any();
difficulty.IsDisabled = configurationDisabled;
difficulty.GetText = () => orderManager.LobbyInfo.GlobalSettings.Difficulty;
difficulty.OnMouseDown = _ =>
@@ -335,9 +335,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
var classes = Rules.Info["world"].Traits.WithInterface<MPStartUnitsInfo>()
.Select(a => a.Class).Distinct();
startingUnits.IsDisabled = configurationDisabled;
startingUnits.IsVisible = () => Map.Options.ConfigurableStartingUnits;
startingUnits.GetText = () => className(orderManager.LobbyInfo.GlobalSettings.StartingUnitsClass);
startingUnits.IsDisabled = () => !Map.Options.ConfigurableStartingUnits || configurationDisabled();
startingUnits.GetText = () => !Map.Options.ConfigurableStartingUnits ? "Not Available" : className(orderManager.LobbyInfo.GlobalSettings.StartingUnitsClass);
startingUnits.OnMouseDown = _ =>
{
var options = classes.Select(c => new DropDownOption