Fixed errors in netlobbyscreen when attempting to select a sub that fails to load (for example due to a missing/corrupt file), campaign cannot be started if the selected submarine cannot be loaded
This commit is contained in:
@@ -57,6 +57,14 @@ namespace Barotrauma
|
||||
|
||||
Submarine selectedSub = subList.SelectedData as Submarine;
|
||||
if (selectedSub == null) return false;
|
||||
|
||||
if (string.IsNullOrEmpty(selectedSub.MD5Hash.Hash))
|
||||
{
|
||||
((GUITextBlock)subList.Selected).TextColor = Color.DarkRed * 0.8f;
|
||||
subList.Selected.CanBeFocused = false;
|
||||
subList.Deselect();
|
||||
return false;
|
||||
}
|
||||
|
||||
string savePath = SaveUtil.CreateSavePath(isMultiplayer ? SaveUtil.SaveType.Multiplayer : SaveUtil.SaveType.Singleplayer, saveNameBox.Text);
|
||||
if (selectedSub.HasTag(SubmarineTag.Shuttle) || !selectedSub.CompatibleContentPackages.Contains(GameMain.SelectedPackage.Name))
|
||||
|
||||
@@ -737,10 +737,11 @@ namespace Barotrauma
|
||||
//hash will be null if opening the sub file failed -> don't select the sub
|
||||
if (string.IsNullOrWhiteSpace(hash))
|
||||
{
|
||||
if (component is GUITextBlock textBlock)
|
||||
GUITextBlock submarineTextBlock = component.GetChild<GUITextBlock>();
|
||||
if (submarineTextBlock != null)
|
||||
{
|
||||
textBlock.TextColor = Color.DarkRed * 0.8f;
|
||||
textBlock.CanBeFocused = false;
|
||||
submarineTextBlock.TextColor = Color.DarkRed * 0.8f;
|
||||
submarineTextBlock.CanBeFocused = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user