Reorganize map options panel.
This commit is contained in:
@@ -29,7 +29,7 @@ namespace OpenRA
|
|||||||
public bool? Shroud;
|
public bool? Shroud;
|
||||||
public bool? FragileAlliances;
|
public bool? FragileAlliances;
|
||||||
public bool ConfigurableStartingUnits = true;
|
public bool ConfigurableStartingUnits = true;
|
||||||
public string[] Difficulties;
|
public string[] Difficulties = { };
|
||||||
|
|
||||||
public void UpdateServerSettings(Session.Global settings)
|
public void UpdateServerSettings(Session.Global settings)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ namespace OpenRA.Mods.RA.Server
|
|||||||
return true;
|
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", "Unsupported difficulty selected: {0}".F(s));
|
||||||
server.SendOrderTo(conn, "Message", "Supported difficulties: {0}".F(server.Map.Options.Difficulties.JoinWith(",")));
|
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)
|
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 = null;
|
||||||
server.lobbyInfo.GlobalSettings.Difficulty = server.Map.Options.Difficulties.First();
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
var difficulty = optionsBin.GetOrNull<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
|
var difficulty = optionsBin.GetOrNull<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
|
||||||
if (difficulty != null)
|
if (difficulty != null)
|
||||||
{
|
{
|
||||||
difficulty.IsVisible = () => Map.Options.Difficulties != null && Map.Options.Difficulties.Any();
|
difficulty.IsVisible = () => Map.Options.Difficulties.Any();
|
||||||
difficulty.IsDisabled = configurationDisabled;
|
difficulty.IsDisabled = configurationDisabled;
|
||||||
difficulty.GetText = () => orderManager.LobbyInfo.GlobalSettings.Difficulty;
|
difficulty.GetText = () => orderManager.LobbyInfo.GlobalSettings.Difficulty;
|
||||||
difficulty.OnMouseDown = _ =>
|
difficulty.OnMouseDown = _ =>
|
||||||
@@ -335,9 +335,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
var classes = Rules.Info["world"].Traits.WithInterface<MPStartUnitsInfo>()
|
var classes = Rules.Info["world"].Traits.WithInterface<MPStartUnitsInfo>()
|
||||||
.Select(a => a.Class).Distinct();
|
.Select(a => a.Class).Distinct();
|
||||||
|
|
||||||
startingUnits.IsDisabled = configurationDisabled;
|
startingUnits.IsDisabled = () => !Map.Options.ConfigurableStartingUnits || configurationDisabled();
|
||||||
startingUnits.IsVisible = () => Map.Options.ConfigurableStartingUnits;
|
startingUnits.GetText = () => !Map.Options.ConfigurableStartingUnits ? "Not Available" : className(orderManager.LobbyInfo.GlobalSettings.StartingUnitsClass);
|
||||||
startingUnits.GetText = () => className(orderManager.LobbyInfo.GlobalSettings.StartingUnitsClass);
|
|
||||||
startingUnits.OnMouseDown = _ =>
|
startingUnits.OnMouseDown = _ =>
|
||||||
{
|
{
|
||||||
var options = classes.Select(c => new DropDownOption
|
var options = classes.Select(c => new DropDownOption
|
||||||
|
|||||||
@@ -206,57 +206,66 @@ Background@LOBBY_OPTIONS_BIN:
|
|||||||
Children:
|
Children:
|
||||||
Label@TITLE:
|
Label@TITLE:
|
||||||
X:0
|
X:0
|
||||||
Y:40
|
Y:30
|
||||||
Width:PARENT_RIGHT
|
Width:PARENT_RIGHT
|
||||||
Height:25
|
Height:25
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Align:Center
|
Align:Center
|
||||||
Text: Map Options
|
Text: Map Options
|
||||||
Checkbox@ALLOWCHEATS_CHECKBOX:
|
Container:
|
||||||
X:80
|
X:20
|
||||||
Y:75
|
Y:65
|
||||||
Width:230
|
Width: PARENT_RIGHT-40
|
||||||
Height:20
|
Height: PARENT_BOTTOM-75
|
||||||
Text:Cheats / Debug Menu
|
Children:
|
||||||
Checkbox@CRATES_CHECKBOX:
|
Checkbox@ALLOWCHEATS_CHECKBOX:
|
||||||
X:80
|
Width:230
|
||||||
Y:110
|
Height:20
|
||||||
Width:230
|
Text:Debug Menu
|
||||||
Height:20
|
Checkbox@FRAGILEALLIANCES_CHECKBOX:
|
||||||
Text:Crates
|
Y:35
|
||||||
Checkbox@SHROUD_CHECKBOX:
|
Width:220
|
||||||
X:310
|
Height:20
|
||||||
Y:75
|
Text:Team Changes
|
||||||
Width:230
|
Checkbox@SHROUD_CHECKBOX:
|
||||||
Height:20
|
X:155
|
||||||
Text:Shroud
|
Width:230
|
||||||
Checkbox@FOG_CHECKBOX:
|
Height:20
|
||||||
X:310
|
Text:Shroud
|
||||||
Y:110
|
Checkbox@FOG_CHECKBOX:
|
||||||
Width:230
|
X:155
|
||||||
Height:20
|
Y:35
|
||||||
Text:Fog of War
|
Width:230
|
||||||
Label@STARTINGUNITS_DESC:
|
Height:20
|
||||||
X:135
|
Text:Fog of War
|
||||||
Y:142
|
Checkbox@CRATES_CHECKBOX:
|
||||||
Width:120
|
X:280
|
||||||
Height:25
|
Width:230
|
||||||
Text:Starting Units:
|
Height:20
|
||||||
DropDownButton@STARTINGUNITS_DROPDOWNBUTTON:
|
Text:Crates Appear
|
||||||
X:230
|
Label@STARTINGUNITS_DESC:
|
||||||
Y:142
|
X:PARENT_RIGHT - WIDTH - 145
|
||||||
Width:140
|
Y:72
|
||||||
Height:25
|
Width:120
|
||||||
Font:Bold
|
Height:25
|
||||||
Label@DIFFICULTY_DESC:
|
Text:Starting Units:
|
||||||
X:125
|
Align:Right
|
||||||
Y:177
|
DropDownButton@STARTINGUNITS_DROPDOWNBUTTON:
|
||||||
Width:120
|
X:PARENT_RIGHT - WIDTH
|
||||||
Height:25
|
Y:72
|
||||||
Text:Mission Difficulty:
|
Width:140
|
||||||
DropDownButton@DIFFICULTY_DROPDOWNBUTTON:
|
Height:25
|
||||||
X:230
|
Font:Bold
|
||||||
Y:177
|
Label@DIFFICULTY_DESC:
|
||||||
Width:100
|
X:PARENT_RIGHT - WIDTH - 145
|
||||||
Height:25
|
Y:107
|
||||||
Font:Bold
|
Width:120
|
||||||
|
Height:25
|
||||||
|
Text:Mission Difficulty:
|
||||||
|
Align:Right
|
||||||
|
DropDownButton@DIFFICULTY_DROPDOWNBUTTON:
|
||||||
|
X:PARENT_RIGHT - WIDTH
|
||||||
|
Y:107
|
||||||
|
Width:140
|
||||||
|
Height:25
|
||||||
|
Font:Bold
|
||||||
@@ -59,63 +59,66 @@ Background@LOBBY_OPTIONS_BIN:
|
|||||||
Children:
|
Children:
|
||||||
Label@TITLE:
|
Label@TITLE:
|
||||||
X:0
|
X:0
|
||||||
Y:40
|
Y:30
|
||||||
Width:PARENT_RIGHT
|
Width:PARENT_RIGHT
|
||||||
Height:25
|
Height:25
|
||||||
Font:Bold
|
Font:Bold
|
||||||
Align:Center
|
Align:Center
|
||||||
Text: Map Options
|
Text: Map Options
|
||||||
Checkbox@ALLOWCHEATS_CHECKBOX:
|
Container:
|
||||||
X:80
|
X:30
|
||||||
Y:75
|
Y:70
|
||||||
Width:230
|
Width: PARENT_RIGHT-60
|
||||||
Height:20
|
Height: PARENT_BOTTOM-75
|
||||||
Text:Cheats / Debug Menu
|
Children:
|
||||||
Checkbox@FRAGILEALLIANCES_CHECKBOX:
|
Checkbox@ALLOWCHEATS_CHECKBOX:
|
||||||
X:80
|
Width:230
|
||||||
Y:110
|
Height:20
|
||||||
Width:220
|
Text:Debug Menu
|
||||||
Height:20
|
Checkbox@FRAGILEALLIANCES_CHECKBOX:
|
||||||
Text:Allow Team Changes
|
Y:40
|
||||||
Checkbox@CRATES_CHECKBOX:
|
Width:220
|
||||||
X:80
|
Height:20
|
||||||
Y:145
|
Text:Team Changes
|
||||||
Width:230
|
Checkbox@SHROUD_CHECKBOX:
|
||||||
Height:20
|
X:175
|
||||||
Text:Crates
|
Width:230
|
||||||
Checkbox@SHROUD_CHECKBOX:
|
Height:20
|
||||||
X:310
|
Text:Shroud
|
||||||
Y:75
|
Checkbox@FOG_CHECKBOX:
|
||||||
Width:230
|
X:175
|
||||||
Height:20
|
Y:40
|
||||||
Text:Shroud
|
Width:230
|
||||||
Checkbox@FOG_CHECKBOX:
|
Height:20
|
||||||
X:310
|
Text:Fog of War
|
||||||
Y:110
|
Checkbox@CRATES_CHECKBOX:
|
||||||
Width:230
|
X:310
|
||||||
Height:20
|
Width:230
|
||||||
Text:Fog of War
|
Height:20
|
||||||
Label@STARTINGUNITS_DESC:
|
Text:Crates Appear
|
||||||
X:215
|
Label@STARTINGUNITS_DESC:
|
||||||
Y:142
|
X:PARENT_RIGHT - WIDTH - 145
|
||||||
Width:120
|
Y:87
|
||||||
Height:25
|
Width:120
|
||||||
Text:Starting Units:
|
Height:25
|
||||||
DropDownButton@STARTINGUNITS_DROPDOWNBUTTON:
|
Text:Starting Units:
|
||||||
X:310
|
Align:Right
|
||||||
Y:142
|
DropDownButton@STARTINGUNITS_DROPDOWNBUTTON:
|
||||||
Width:140
|
X:PARENT_RIGHT - WIDTH
|
||||||
Height:25
|
Y:87
|
||||||
Font:Bold
|
Width:140
|
||||||
Label@DIFFICULTY_DESC:
|
Height:25
|
||||||
X:195
|
Font:Bold
|
||||||
Y:177
|
Label@DIFFICULTY_DESC:
|
||||||
Width:120
|
X:PARENT_RIGHT - WIDTH - 145
|
||||||
Height:25
|
Y:122
|
||||||
Text:Mission Difficulty:
|
Width:120
|
||||||
DropDownButton@DIFFICULTY_DROPDOWNBUTTON:
|
Height:25
|
||||||
X:310
|
Text:Mission Difficulty:
|
||||||
Y:177
|
Align:Right
|
||||||
Width:100
|
DropDownButton@DIFFICULTY_DROPDOWNBUTTON:
|
||||||
Height:25
|
X:PARENT_RIGHT - WIDTH
|
||||||
Font:Bold
|
Y:122
|
||||||
|
Width:140
|
||||||
|
Height:25
|
||||||
|
Font:Bold
|
||||||
|
|||||||
Reference in New Issue
Block a user