Merge branch 'master' into new-netcode

Conflicts:
	Subsurface/Source/GUI/GUITextBlock.cs
	Subsurface/Source/GameMain.cs
	Subsurface/Source/Items/Components/Machines/Radar.cs
	Subsurface/Source/Networking/GameClient.cs
This commit is contained in:
Regalis
2017-05-17 18:51:22 +03:00
26 changed files with 261 additions and 207 deletions

View File

@@ -550,23 +550,13 @@ namespace Barotrauma
deleteButton.UserData = "delete";
deleteButton.OnClicked = (btn, userdata) =>
{
if (subList.Selected!=null)
if (subList.Selected != null)
{
Submarine sub = subList.Selected.UserData as Submarine;
try
{
File.Delete(sub.FilePath);
}
catch (Exception e)
{
DebugConsole.ThrowError("Couldn't delete file \""+sub.FilePath+"\"!", e);
}
TryDeleteSub(subList.Selected.UserData as Submarine);
}
deleteButton.Enabled = false;
CreateLoadScreen();
return true;
};
@@ -603,6 +593,29 @@ namespace Barotrauma
return true;
}
private void TryDeleteSub(Submarine sub)
{
if (sub == null) return;
var msgBox = new GUIMessageBox("Delete file?", "Are you sure you want to delete \"" + sub.Name + "\"", new string[] { "OK", "Cancel" });
msgBox.Buttons[0].OnClicked += (btn, userData) =>
{
try
{
sub.Remove();
File.Delete(sub.FilePath);
CreateLoadScreen();
}
catch (Exception e)
{
DebugConsole.ThrowError("Couldn't delete file \"" + sub.FilePath + "\"!", e);
}
return true;
};
msgBox.Buttons[0].OnClicked += msgBox.Close;
msgBox.Buttons[1].OnClicked += msgBox.Close;
}
private bool SelectTab(GUIButton button, object obj)
{
if (characterMode) ToggleCharacterMode();