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

@@ -29,7 +29,7 @@ namespace OpenRA
public bool? Shroud;
public bool? FragileAlliances;
public bool ConfigurableStartingUnits = true;
public string[] Difficulties;
public string[] Difficulties = { };
public void UpdateServerSettings(Session.Global settings)
{

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

View File

@@ -206,57 +206,66 @@ Background@LOBBY_OPTIONS_BIN:
Children:
Label@TITLE:
X:0
Y:40
Y:30
Width:PARENT_RIGHT
Height:25
Font:Bold
Align:Center
Text: Map Options
Checkbox@ALLOWCHEATS_CHECKBOX:
X:80
Y:75
Width:230
Height:20
Text:Cheats / Debug Menu
Checkbox@CRATES_CHECKBOX:
X:80
Y:110
Width:230
Height:20
Text:Crates
Checkbox@SHROUD_CHECKBOX:
X:310
Y:75
Width:230
Height:20
Text:Shroud
Checkbox@FOG_CHECKBOX:
X:310
Y:110
Width:230
Height:20
Text:Fog of War
Label@STARTINGUNITS_DESC:
X:135
Y:142
Width:120
Height:25
Text:Starting Units:
DropDownButton@STARTINGUNITS_DROPDOWNBUTTON:
X:230
Y:142
Width:140
Height:25
Font:Bold
Label@DIFFICULTY_DESC:
X:125
Y:177
Width:120
Height:25
Text:Mission Difficulty:
DropDownButton@DIFFICULTY_DROPDOWNBUTTON:
X:230
Y:177
Width:100
Height:25
Font:Bold
Container:
X:20
Y:65
Width: PARENT_RIGHT-40
Height: PARENT_BOTTOM-75
Children:
Checkbox@ALLOWCHEATS_CHECKBOX:
Width:230
Height:20
Text:Debug Menu
Checkbox@FRAGILEALLIANCES_CHECKBOX:
Y:35
Width:220
Height:20
Text:Team Changes
Checkbox@SHROUD_CHECKBOX:
X:155
Width:230
Height:20
Text:Shroud
Checkbox@FOG_CHECKBOX:
X:155
Y:35
Width:230
Height:20
Text:Fog of War
Checkbox@CRATES_CHECKBOX:
X:280
Width:230
Height:20
Text:Crates Appear
Label@STARTINGUNITS_DESC:
X:PARENT_RIGHT - WIDTH - 145
Y:72
Width:120
Height:25
Text:Starting Units:
Align:Right
DropDownButton@STARTINGUNITS_DROPDOWNBUTTON:
X:PARENT_RIGHT - WIDTH
Y:72
Width:140
Height:25
Font:Bold
Label@DIFFICULTY_DESC:
X:PARENT_RIGHT - WIDTH - 145
Y:107
Width:120
Height:25
Text:Mission Difficulty:
Align:Right
DropDownButton@DIFFICULTY_DROPDOWNBUTTON:
X:PARENT_RIGHT - WIDTH
Y:107
Width:140
Height:25
Font:Bold

View File

@@ -59,63 +59,66 @@ Background@LOBBY_OPTIONS_BIN:
Children:
Label@TITLE:
X:0
Y:40
Y:30
Width:PARENT_RIGHT
Height:25
Font:Bold
Align:Center
Text: Map Options
Checkbox@ALLOWCHEATS_CHECKBOX:
X:80
Y:75
Width:230
Height:20
Text:Cheats / Debug Menu
Checkbox@FRAGILEALLIANCES_CHECKBOX:
X:80
Y:110
Width:220
Height:20
Text:Allow Team Changes
Checkbox@CRATES_CHECKBOX:
X:80
Y:145
Width:230
Height:20
Text:Crates
Checkbox@SHROUD_CHECKBOX:
X:310
Y:75
Width:230
Height:20
Text:Shroud
Checkbox@FOG_CHECKBOX:
X:310
Y:110
Width:230
Height:20
Text:Fog of War
Label@STARTINGUNITS_DESC:
X:215
Y:142
Width:120
Height:25
Text:Starting Units:
DropDownButton@STARTINGUNITS_DROPDOWNBUTTON:
X:310
Y:142
Width:140
Height:25
Font:Bold
Label@DIFFICULTY_DESC:
X:195
Y:177
Width:120
Height:25
Text:Mission Difficulty:
DropDownButton@DIFFICULTY_DROPDOWNBUTTON:
X:310
Y:177
Width:100
Height:25
Font:Bold
Container:
X:30
Y:70
Width: PARENT_RIGHT-60
Height: PARENT_BOTTOM-75
Children:
Checkbox@ALLOWCHEATS_CHECKBOX:
Width:230
Height:20
Text:Debug Menu
Checkbox@FRAGILEALLIANCES_CHECKBOX:
Y:40
Width:220
Height:20
Text:Team Changes
Checkbox@SHROUD_CHECKBOX:
X:175
Width:230
Height:20
Text:Shroud
Checkbox@FOG_CHECKBOX:
X:175
Y:40
Width:230
Height:20
Text:Fog of War
Checkbox@CRATES_CHECKBOX:
X:310
Width:230
Height:20
Text:Crates Appear
Label@STARTINGUNITS_DESC:
X:PARENT_RIGHT - WIDTH - 145
Y:87
Width:120
Height:25
Text:Starting Units:
Align:Right
DropDownButton@STARTINGUNITS_DROPDOWNBUTTON:
X:PARENT_RIGHT - WIDTH
Y:87
Width:140
Height:25
Font:Bold
Label@DIFFICULTY_DESC:
X:PARENT_RIGHT - WIDTH - 145
Y:122
Width:120
Height:25
Text:Mission Difficulty:
Align:Right
DropDownButton@DIFFICULTY_DROPDOWNBUTTON:
X:PARENT_RIGHT - WIDTH
Y:122
Width:140
Height:25
Font:Bold