(2c4d0cf44) Fixed memorystream not being disposed when saving a submarine preview image
This commit is contained in:
@@ -66,6 +66,33 @@ namespace Barotrauma
|
|||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Point scrollButtonSize = new Point((int)(200 * GUI.Scale), (int)(30 * GUI.Scale));
|
||||||
|
|
||||||
|
crewArea = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.CrewArea, guiFrame.RectTransform), "", Color.Transparent)
|
||||||
|
{
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
toggleCrewButton = new GUIButton(new RectTransform(new Point((int)(30 * GUI.Scale), HUDLayoutSettings.CrewArea.Height), guiFrame.RectTransform)
|
||||||
|
{ AbsoluteOffset = HUDLayoutSettings.CrewArea.Location },
|
||||||
|
"", style: "UIToggleButton");
|
||||||
|
toggleCrewButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||||
|
{
|
||||||
|
toggleCrewAreaOpen = !toggleCrewAreaOpen;
|
||||||
|
foreach (GUIComponent child in btn.Children)
|
||||||
|
{
|
||||||
|
child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
characterListBox = new GUIListBox(new RectTransform(new Point(100, (int)(crewArea.Rect.Height - scrollButtonSize.Y * 1.6f)), crewArea.RectTransform, Anchor.CenterLeft), false, Color.Transparent, null)
|
||||||
|
{
|
||||||
|
//Spacing = (int)(3 * GUI.Scale),
|
||||||
|
ScrollBarEnabled = false,
|
||||||
|
ScrollBarVisible = false,
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
|
||||||
var characterInfo = new CharacterInfo(subElement);
|
var characterInfo = new CharacterInfo(subElement);
|
||||||
characterInfos.Add(characterInfo);
|
characterInfos.Add(characterInfo);
|
||||||
foreach (XElement invElement in subElement.Elements())
|
foreach (XElement invElement in subElement.Elements())
|
||||||
@@ -81,6 +108,16 @@ namespace Barotrauma
|
|||||||
prevUIScale = GUI.Scale;
|
prevUIScale = GUI.Scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Character list management
|
||||||
|
|
||||||
|
public Rectangle GetCharacterListArea()
|
||||||
|
{
|
||||||
|
return characterListBox.Rect;
|
||||||
|
}
|
||||||
|
|
||||||
partial void InitProjectSpecific()
|
partial void InitProjectSpecific()
|
||||||
{
|
{
|
||||||
guiFrame = new GUIFrame(new RectTransform(Vector2.One, GUICanvas.Instance), null, Color.Transparent)
|
guiFrame = new GUIFrame(new RectTransform(Vector2.One, GUICanvas.Instance), null, Color.Transparent)
|
||||||
|
|||||||
@@ -840,10 +840,11 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MemoryStream imgStream = new MemoryStream();
|
using (MemoryStream imgStream = new MemoryStream())
|
||||||
CreateImage(defaultPreviewImageSize.X, defaultPreviewImageSize.Y, imgStream);
|
{
|
||||||
|
CreateImage(defaultPreviewImageSize.X, defaultPreviewImageSize.Y, imgStream);
|
||||||
Submarine.SaveCurrent(savePath, imgStream);
|
Submarine.SaveCurrent(savePath, imgStream);
|
||||||
|
}
|
||||||
Submarine.MainSub.CheckForErrors();
|
Submarine.MainSub.CheckForErrors();
|
||||||
|
|
||||||
GUI.AddMessage(TextManager.Get("SubSavedNotification").Replace("[filepath]", Submarine.MainSub.FilePath), Color.Green);
|
GUI.AddMessage(TextManager.Get("SubSavedNotification").Replace("[filepath]", Submarine.MainSub.FilePath), Color.Green);
|
||||||
|
|||||||
Reference in New Issue
Block a user