Fixed clients failing to select a received submarine/shuttle file, preventing them from starting a round until they rejoin the server. Closes #271
This commit is contained in:
@@ -170,14 +170,14 @@ namespace Barotrauma
|
||||
|
||||
private bool OnClicked(GUIComponent component, object obj)
|
||||
{
|
||||
if (wasOpened || !Enabled) return false;
|
||||
if (wasOpened) return false;
|
||||
|
||||
wasOpened = true;
|
||||
Dropped = !Dropped;
|
||||
|
||||
if (Dropped)
|
||||
{
|
||||
OnDropped?.Invoke(this, userData);
|
||||
if (Enabled) OnDropped?.Invoke(this, userData);
|
||||
if (parent.children[parent.children.Count - 1] != this)
|
||||
{
|
||||
parent.children.Remove(this);
|
||||
|
||||
@@ -288,8 +288,8 @@ namespace Barotrauma.Networking
|
||||
string errorMessage = "";
|
||||
if (ValidateReceivedData(activeTransfer, out errorMessage))
|
||||
{
|
||||
OnFinished(activeTransfer);
|
||||
StopTransfer(activeTransfer);
|
||||
OnFinished(activeTransfer);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -433,7 +433,7 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("Failed to delete file \""+transfer.FilePath+"\" ("+e.Message+")");
|
||||
DebugConsole.ThrowError("Failed to delete file \"" + transfer.FilePath + "\" (" + e.Message + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1187,16 +1187,43 @@ namespace Barotrauma.Networking
|
||||
GameMain.NetLobbyScreen.ShuttleList.ListBox.children :
|
||||
GameMain.NetLobbyScreen.SubList.children;
|
||||
|
||||
var textBlock = subListChildren.Find(c =>
|
||||
var subElement = subListChildren.Find(c =>
|
||||
((Submarine)c.UserData).Name == newSub.Name &&
|
||||
((Submarine)c.UserData).MD5Hash.Hash == newSub.MD5Hash.Hash) as GUITextBlock;
|
||||
((Submarine)c.UserData).MD5Hash.Hash == newSub.MD5Hash.Hash);
|
||||
|
||||
if (textBlock == null) continue;
|
||||
textBlock.TextColor = new Color(textBlock.TextColor, 1.0f);
|
||||
if (subElement == null) continue;
|
||||
subElement.GetChild<GUITextBlock>().TextColor = new Color(subElement.GetChild<GUITextBlock>().TextColor, 1.0f);
|
||||
subElement.UserData = newSub;
|
||||
subElement.ToolTip = newSub.Description;
|
||||
|
||||
textBlock.UserData = newSub;
|
||||
textBlock.ToolTip = newSub.Description;
|
||||
GUIButton infoButton = subElement.GetChild<GUIButton>();
|
||||
if (infoButton == null)
|
||||
{
|
||||
infoButton = new GUIButton(new Rectangle(0, 0, 20, 20), "?", Alignment.CenterLeft, "", subElement);
|
||||
}
|
||||
infoButton.UserData = newSub;
|
||||
infoButton.OnClicked = (component, userdata) =>
|
||||
{
|
||||
var msgBox = new GUIMessageBox("", "", 550, 400);
|
||||
((Submarine)userdata).CreatePreviewWindow(msgBox.InnerFrame);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
if (GameMain.NetLobbyScreen.FailedSelectedSub != null &&
|
||||
GameMain.NetLobbyScreen.FailedSelectedSub.First == newSub.Name &&
|
||||
GameMain.NetLobbyScreen.FailedSelectedSub.Second == newSub.MD5Hash.Hash)
|
||||
{
|
||||
GameMain.NetLobbyScreen.TrySelectSub(newSub.Name, newSub.MD5Hash.Hash, GameMain.NetLobbyScreen.SubList);
|
||||
}
|
||||
|
||||
if (GameMain.NetLobbyScreen.FailedSelectedShuttle != null &&
|
||||
GameMain.NetLobbyScreen.FailedSelectedShuttle.First == newSub.Name &&
|
||||
GameMain.NetLobbyScreen.FailedSelectedShuttle.Second == newSub.MD5Hash.Hash)
|
||||
{
|
||||
GameMain.NetLobbyScreen.TrySelectSub(newSub.Name, newSub.MD5Hash.Hash, GameMain.NetLobbyScreen.ShuttleList.ListBox);
|
||||
}
|
||||
|
||||
break;
|
||||
case FileTransferType.CampaignSave:
|
||||
var campaign = GameMain.GameSession?.GameMode as MultiplayerCampaign;
|
||||
|
||||
@@ -265,7 +265,7 @@ namespace Barotrauma
|
||||
//respawn shuttle ------------------------------------------------------------------
|
||||
|
||||
shuttleTickBox = new GUITickBox(new Rectangle(columnX, 110, 20, 20), TextManager.Get("RespawnShuttle"), Alignment.Left, defaultModeContainer);
|
||||
shuttleList = new GUIDropDown(new Rectangle(columnX, 140, 200, 20), "", "", defaultModeContainer);
|
||||
shuttleList = new GUIDropDown(new Rectangle(columnX, 140, columnWidth, 20), "", "", defaultModeContainer);
|
||||
shuttleTickBox.Selected = true;
|
||||
shuttleTickBox.OnSelected = (GUITickBox box) =>
|
||||
{
|
||||
@@ -1421,6 +1421,9 @@ namespace Barotrauma
|
||||
GameMain.Config.JobNamePreferences = jobNamePreferences;
|
||||
}
|
||||
|
||||
public Pair<string, string> FailedSelectedSub;
|
||||
public Pair<string, string> FailedSelectedShuttle;
|
||||
|
||||
public bool TrySelectSub(string subName, string md5Hash, GUIListBox subList)
|
||||
{
|
||||
if (GameMain.Client == null) return false;
|
||||
@@ -1440,10 +1443,20 @@ namespace Barotrauma
|
||||
subList.OnSelected -= VotableClicked;
|
||||
subList.Select(subList.children.IndexOf(matchingListSub), true);
|
||||
subList.OnSelected += VotableClicked;
|
||||
|
||||
if (subList == SubList)
|
||||
FailedSelectedSub = null;
|
||||
else
|
||||
FailedSelectedShuttle = null;
|
||||
}
|
||||
|
||||
if (sub == null || sub.MD5Hash.Hash != md5Hash)
|
||||
{
|
||||
if (subList == SubList)
|
||||
FailedSelectedSub = Pair<string, string>.Create(subName, md5Hash);
|
||||
else
|
||||
FailedSelectedShuttle = Pair<string, string>.Create(subName, md5Hash);
|
||||
|
||||
string errorMsg = "";
|
||||
if (sub == null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user