Fix default difficulty not being serialised
This commit is contained in:
@@ -498,6 +498,12 @@ namespace OpenRA.Mods.RA.Server
|
|||||||
.Select(p => MakeSlotFromPlayerReference(p.Value))
|
.Select(p => MakeSlotFromPlayerReference(p.Value))
|
||||||
.Where(s => s != null)
|
.Where(s => s != null)
|
||||||
.ToDictionary(s => s.PlayerReference, s => s);
|
.ToDictionary(s => s.PlayerReference, s => s);
|
||||||
|
|
||||||
|
if (server.Map.Difficulties != null && server.Map.Difficulties.Any())
|
||||||
|
if (!server.Map.Difficulties.Contains(server.lobbyInfo.GlobalSettings.Difficulty))
|
||||||
|
server.lobbyInfo.GlobalSettings.Difficulty = server.Map.Difficulties.First();
|
||||||
|
else
|
||||||
|
server.lobbyInfo.GlobalSettings.Difficulty = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,12 +159,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
var difficulty = lobby.Get<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
|
var difficulty = lobby.Get<DropDownButtonWidget>("DIFFICULTY_DROPDOWNBUTTON");
|
||||||
difficulty.IsVisible = () => Map != null && Map.Difficulties != null && Map.Difficulties.Any();
|
difficulty.IsVisible = () => Map != null && Map.Difficulties != null && Map.Difficulties.Any();
|
||||||
difficulty.IsDisabled = () => !Game.IsHost || gameStarting || orderManager.LocalClient == null || orderManager.LocalClient.IsReady;
|
difficulty.IsDisabled = () => !Game.IsHost || gameStarting || orderManager.LocalClient == null || orderManager.LocalClient.IsReady;
|
||||||
difficulty.GetText = () => orderManager.LobbyInfo.GlobalSettings.Difficulty ?? "";
|
difficulty.GetText = () => orderManager.LobbyInfo.GlobalSettings.Difficulty;
|
||||||
difficulty.OnMouseDown = _ =>
|
difficulty.OnMouseDown = _ =>
|
||||||
{
|
{
|
||||||
var options = Map.Difficulties.Select(d => new DifficultyDropDownOption
|
var options = Map.Difficulties.Select(d => new DifficultyDropDownOption
|
||||||
{
|
{
|
||||||
Title = d ?? "",
|
Title = d,
|
||||||
IsSelected = () => orderManager.LobbyInfo.GlobalSettings.Difficulty == d,
|
IsSelected = () => orderManager.LobbyInfo.GlobalSettings.Difficulty == d,
|
||||||
OnClick = () => orderManager.IssueOrder(Order.Command("difficulty {0}".F(d)))
|
OnClick = () => orderManager.IssueOrder(Order.Command("difficulty {0}".F(d)))
|
||||||
});
|
});
|
||||||
@@ -270,8 +270,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
|
|
||||||
var title = Ui.Root.Get<LabelWidget>("TITLE");
|
var title = Ui.Root.Get<LabelWidget>("TITLE");
|
||||||
title.Text = orderManager.LobbyInfo.GlobalSettings.ServerName;
|
title.Text = orderManager.LobbyInfo.GlobalSettings.ServerName;
|
||||||
|
|
||||||
orderManager.LobbyInfo.GlobalSettings.Difficulty = Map.Difficulties != null && Map.Difficulties.Any() ? Map.Difficulties.First() : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePlayerList()
|
void UpdatePlayerList()
|
||||||
|
|||||||
Reference in New Issue
Block a user