Pausing all sounds when switching to editor screen, temp save folder is cleared before saving (fixes unnecessary files being included in saves)
This commit is contained in:
@@ -314,6 +314,10 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
SoundPlayer.OverrideMusicType = "none";
|
||||
for (int i = 0; i < Sounds.SoundManager.DefaultSourceCount; i++)
|
||||
{
|
||||
Sounds.SoundManager.Pause(i);
|
||||
}
|
||||
|
||||
cam.UpdateTransform();
|
||||
}
|
||||
@@ -333,6 +337,10 @@ namespace Barotrauma
|
||||
if (wiringMode) ToggleWiringMode();
|
||||
|
||||
SoundPlayer.OverrideMusicType = null;
|
||||
for (int i = 0; i < Sounds.SoundManager.DefaultSourceCount; i++)
|
||||
{
|
||||
Sounds.SoundManager.Resume(i);
|
||||
}
|
||||
|
||||
if (dummyCharacter != null)
|
||||
{
|
||||
|
||||
@@ -22,9 +22,19 @@ namespace Barotrauma
|
||||
fileName = Path.Combine(SaveFolder, fileName);
|
||||
|
||||
string tempPath = Path.Combine(SaveFolder, "temp");
|
||||
|
||||
Directory.CreateDirectory(tempPath);
|
||||
|
||||
DirectoryInfo dir = new DirectoryInfo(tempPath);
|
||||
|
||||
Directory.CreateDirectory(tempPath);
|
||||
try
|
||||
{
|
||||
ClearFolder(tempPath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (Submarine.MainSub != null)
|
||||
@@ -274,5 +284,22 @@ namespace Barotrauma
|
||||
using (GZipStream zipStream = new GZipStream(inFile, CompressionMode.Decompress, true))
|
||||
while (DecompressFile(sDir, zipStream, progress)) ;
|
||||
}
|
||||
|
||||
private static void ClearFolder(string FolderName)
|
||||
{
|
||||
DirectoryInfo dir = new DirectoryInfo(FolderName);
|
||||
|
||||
foreach (FileInfo fi in dir.GetFiles())
|
||||
{
|
||||
fi.IsReadOnly = false;
|
||||
fi.Delete();
|
||||
}
|
||||
|
||||
foreach (DirectoryInfo di in dir.GetDirectories())
|
||||
{
|
||||
ClearFolder(di.FullName);
|
||||
di.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user