diff --git a/Subsurface/Source/Characters/CharacterHUD.cs b/Subsurface/Source/Characters/CharacterHUD.cs index 96f158ee8..16fd2bdd6 100644 --- a/Subsurface/Source/Characters/CharacterHUD.cs +++ b/Subsurface/Source/Characters/CharacterHUD.cs @@ -38,7 +38,7 @@ namespace Barotrauma if (cprButton != null && cprButton.Visible) cprButton.Update(deltaTime); - if (GameMain.NetworkMember != null && suicideButton != null && suicideButton.Visible) suicideButton.Update(deltaTime); + if (suicideButton != null && suicideButton.Visible) suicideButton.Update(deltaTime); if (damageOverlayTimer > 0.0f) damageOverlayTimer -= deltaTime; } @@ -174,7 +174,7 @@ namespace Barotrauma new Vector2(GameMain.GraphicsWidth / damageOverlay.size.X, GameMain.GraphicsHeight / damageOverlay.size.Y)); } - if (character.IsUnconscious && GameMain.NetworkMember!=null) + if (character.IsUnconscious) { if (suicideButton == null) { diff --git a/Subsurface/Source/DebugConsole.cs b/Subsurface/Source/DebugConsole.cs index a898743ca..d5ce32bc7 100644 --- a/Subsurface/Source/DebugConsole.cs +++ b/Subsurface/Source/DebugConsole.cs @@ -58,9 +58,9 @@ namespace Barotrauma frame.Color = Color.White * 0.4f; frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); - listBox = new GUIListBox(new Rectangle(0,0,0, frame.Rect.Height-40), Color.Black*0.9f, null, frame); + listBox = new GUIListBox(new Rectangle(0,0,0, frame.Rect.Height-40), Color.Black*0.9f, GUI.Style, frame); - textBox = new GUITextBox(new Rectangle(0,0,0,20), Color.Black*0.6f, Color.White, Alignment.BottomLeft, Alignment.Left, null, frame); + textBox = new GUITextBox(new Rectangle(0,0,0,20), Color.Black*0.6f, Color.White, Alignment.BottomLeft, Alignment.Left, GUI.Style, frame); NewMessage("Press F3 to open/close the debug console", Color.Cyan); NewMessage("Enter ''help'' for a list of available console commands", Color.Cyan); @@ -513,6 +513,8 @@ namespace Barotrauma DebugConsole.NewMessage("Resolution set to 0 x 0 (screen resolution will be used)", Color.Green); DebugConsole.NewMessage("Fullscreen enabled", Color.Green); + GameSettings.VerboseLogging = false; + if (GameMain.Config.MasterServerUrl != "http://www.undertowgames.com/baromaster") { DebugConsole.ThrowError("MasterServerUrl ''"+GameMain.Config.MasterServerUrl+"''!"); @@ -590,7 +592,7 @@ namespace Barotrauma try { - var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 15), msg, GUI.Style, Alignment.TopLeft, Alignment.Left, null, true, GUI.SmallFont); + var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), msg, GUI.Style, Alignment.TopLeft, Alignment.Left, null, true, GUI.SmallFont); textBlock.CanBeFocused = false; textBlock.TextColor = color; diff --git a/Subsurface/Source/GUI/GUI.cs b/Subsurface/Source/GUI/GUI.cs index 8e2dee86c..75ea8bcb7 100644 --- a/Subsurface/Source/GUI/GUI.cs +++ b/Subsurface/Source/GUI/GUI.cs @@ -70,6 +70,8 @@ namespace Barotrauma LargeFont = ToolBox.TryLoadFont("LargeFont", content); cursor = new Sprite("Content/UI/cursor.png", Vector2.Zero); + + Style = new GUIStyle("Content/UI/style.xml"); } public static bool PauseMenuOpen @@ -107,8 +109,6 @@ namespace Barotrauma SpeechBubbleIcon = new Sprite("Content/UI/uiIcons.png", new Rectangle(0, 129, 65, 61), null); SpeechBubbleIcon.Origin = SpeechBubbleIcon.size / 2; - - Style = new GUIStyle("Content/UI/style.xml"); } public static void TogglePauseMenu() diff --git a/Subsurface/Source/GUI/GUIListBox.cs b/Subsurface/Source/GUI/GUIListBox.cs index 2cf559999..8e466b1de 100644 --- a/Subsurface/Source/GUI/GUIListBox.cs +++ b/Subsurface/Source/GUI/GUIListBox.cs @@ -230,8 +230,8 @@ namespace Barotrauma } scrollBar.BarSize = scrollBar.IsHorizontal ? - Math.Min((float)rect.Width / (float)totalSize, 1.0f) : - Math.Min((float)rect.Height / (float)totalSize, 1.0f); + Math.Max(Math.Min((float)rect.Width / (float)totalSize, 1.0f), 5.0f / rect.Width) : + Math.Max(Math.Min((float)rect.Height / (float)totalSize, 1.0f), 5.0f / rect.Height); if (scrollBar.BarSize < 1.0f && scrollBarHidden) ShowScrollBar(); if (scrollBar.BarSize >= 1.0f && !scrollBarHidden) HideScrollBar(); diff --git a/Subsurface/Source/GUI/GUITextBlock.cs b/Subsurface/Source/GUI/GUITextBlock.cs index e230e0601..cb5852d16 100644 --- a/Subsurface/Source/GUI/GUITextBlock.cs +++ b/Subsurface/Source/GUI/GUITextBlock.cs @@ -159,7 +159,7 @@ namespace Barotrauma if (rect.Height == 0 && !string.IsNullOrWhiteSpace(Text)) { - this.rect.Height = (int)Font.MeasureString(Text).Y; + this.rect.Height = (int)Font.MeasureString(wrappedText).Y; } } diff --git a/Subsurface/Source/GameSession/CrewManager.cs b/Subsurface/Source/GameSession/CrewManager.cs index 67c2422b4..68e3c0a48 100644 --- a/Subsurface/Source/GameSession/CrewManager.cs +++ b/Subsurface/Source/GameSession/CrewManager.cs @@ -68,7 +68,7 @@ namespace Barotrauma //listBox.Select(selection); Character character = selection as Character; - if (character == null || character.IsDead) return false; + if (character == null || character.IsDead || character.IsUnconscious) return false; if (characters.Contains(character)) { @@ -242,7 +242,7 @@ namespace Barotrauma protected virtual bool SelectCrewCharacter(GUIComponent component, object obj) { Character character = obj as Character; - if (character == null) return false; + if (character == null || character.IsDead || character.IsUnconscious) return false; var crewFrame = component.Parent; while (crewFrame.Parent!=null) diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs index a7a17ff7b..6deee76ae 100644 --- a/Subsurface/Source/Items/Item.cs +++ b/Subsurface/Source/Items/Item.cs @@ -67,7 +67,7 @@ namespace Barotrauma { if (hasInGameEditableProperties==null) { - hasInGameEditableProperties = GetProperties().Count>0; + hasInGameEditableProperties = GetProperties().Any(); } return (bool)hasInGameEditableProperties; } @@ -882,6 +882,20 @@ namespace Barotrauma } } + public void DrawInGameEditing(SpriteBatch spriteBatch) + { + if (editingHUD == null || editingHUD.UserData as Item != this) + { + editingHUD = CreateEditingHUD(true); + } + + if (editingHUD.Rect.Height > 60) + { + editingHUD.Update((float)Physics.step); + editingHUD.Draw(spriteBatch); + } + } + private GUIComponent CreateEditingHUD(bool inGame=false) { int width = 450; @@ -949,6 +963,8 @@ namespace Barotrauma GUITickBox propertyTickBox = new GUITickBox(new Rectangle(10, y, 20, 20), objectProperty.Name, Alignment.Left, editingHUD); + propertyTickBox.Selected = (bool)value; + propertyTickBox.UserData = objectProperty; propertyTickBox.OnSelected = EnterProperty; } @@ -994,16 +1010,7 @@ namespace Barotrauma if (HasInGameEditableProperties) { - if (editingHUD == null || editingHUD.UserData as Item != this) - { - editingHUD = CreateEditingHUD(true); - } - - if (editingHUD.Rect.Height > 60) - { - editingHUD.Update((float)Physics.step); - editingHUD.Draw(spriteBatch); - } + DrawInGameEditing(spriteBatch); } foreach (ItemComponent ic in components)