diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs index 4333dc5c4..91bb79c26 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs @@ -66,6 +66,33 @@ namespace Barotrauma 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); characterInfos.Add(characterInfo); foreach (XElement invElement in subElement.Elements()) @@ -81,6 +108,16 @@ namespace Barotrauma prevUIScale = GUI.Scale; } + + #endregion + + #region Character list management + + public Rectangle GetCharacterListArea() + { + return characterListBox.Rect; + } + partial void InitProjectSpecific() { guiFrame = new GUIFrame(new RectTransform(Vector2.One, GUICanvas.Instance), null, Color.Transparent) diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs index 9a97ade23..bea9e3e0c 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs @@ -840,10 +840,11 @@ namespace Barotrauma } #endif - MemoryStream imgStream = new MemoryStream(); - CreateImage(defaultPreviewImageSize.X, defaultPreviewImageSize.Y, imgStream); - - Submarine.SaveCurrent(savePath, imgStream); + using (MemoryStream imgStream = new MemoryStream()) + { + CreateImage(defaultPreviewImageSize.X, defaultPreviewImageSize.Y, imgStream); + Submarine.SaveCurrent(savePath, imgStream); + } Submarine.MainSub.CheckForErrors(); GUI.AddMessage(TextManager.Get("SubSavedNotification").Replace("[filepath]", Submarine.MainSub.FilePath), Color.Green);