diff --git a/.vs/Subsurface_Solution/v14/.suo b/.vs/Subsurface_Solution/v14/.suo index 4eb89efd5..15cdce81c 100644 Binary files a/.vs/Subsurface_Solution/v14/.suo and b/.vs/Subsurface_Solution/v14/.suo differ diff --git a/Subsurface/Content/InfoTexts.xml b/Subsurface/Content/InfoTexts.xml index f22898e21..5b0635aa3 100644 --- a/Subsurface/Content/InfoTexts.xml +++ b/Subsurface/Content/InfoTexts.xml @@ -16,7 +16,7 @@ You have bled out. You have drowned. You have suffocated. - You have been crushed by water pressure. + You have been crushed by water pressure. You have burned to death. \ No newline at end of file diff --git a/Subsurface/Content/Missions.xml b/Subsurface/Content/Missions.xml index 8d15fabde..811751a17 100644 --- a/Subsurface/Content/Missions.xml +++ b/Subsurface/Content/Missions.xml @@ -46,13 +46,24 @@ + + + + \ No newline at end of file diff --git a/Subsurface/Content/randomevents.xml b/Subsurface/Content/randomevents.xml index 653076aa8..660868cdb 100644 --- a/Subsurface/Content/randomevents.xml +++ b/Subsurface/Content/randomevents.xml @@ -33,5 +33,13 @@ difficulty="5" minamount="1" maxamount="1" musictype="monster"/> + + \ No newline at end of file diff --git a/Subsurface/Source/Characters/Animation/Ragdoll.cs b/Subsurface/Source/Characters/Animation/Ragdoll.cs index c07551fce..85bf2a188 100644 --- a/Subsurface/Source/Characters/Animation/Ragdoll.cs +++ b/Subsurface/Source/Characters/Animation/Ragdoll.cs @@ -340,17 +340,17 @@ namespace Barotrauma } } - if (targetMovement.Y >= 0.0f && lowestLimb.SimPosition.Y > ConvertUnits.ToSimUnits(structure.Rect.Y - Submarine.GridSize.Y * 8.0f)) - { - //stairs = null; - //return false; - } + //if (targetMovement.Y >= 0.0f && lowestLimb.SimPosition.Y > ConvertUnits.ToSimUnits(structure.Rect.Y - Submarine.GridSize.Y * 8.0f)) + //{ + // //stairs = null; + // //return false; + //} Limb limb = f1.Body.UserData as Limb; if (limb != null)// && (limb.type == LimbType.LeftFoot || limb.type == LimbType.RightFoot)) { if (contact.Manifold.LocalNormal.Y >= 0.0f) - { + { if (limb.SimPosition.Y < lowestLimb.SimPosition.Y+0.2f) { stairs = structure; diff --git a/Subsurface/Source/Characters/CharacterHUD.cs b/Subsurface/Source/Characters/CharacterHUD.cs index 6ffbf8868..ce05b96c6 100644 --- a/Subsurface/Source/Characters/CharacterHUD.cs +++ b/Subsurface/Source/Characters/CharacterHUD.cs @@ -58,11 +58,12 @@ namespace Barotrauma startPos = cam.WorldToScreen(startPos); Vector2 textPos = startPos; + textPos -= new Vector2(GUI.Font.MeasureString(character.ClosestCharacter.Info.Name).X / 2, 20); - float stringWidth = GUI.Font.MeasureString(character.ClosestCharacter.Info.Name).X; - textPos -= new Vector2(stringWidth / 2, 20); - spriteBatch.DrawString(GUI.Font, character.ClosestCharacter.Info.Name, textPos, Color.Black); - spriteBatch.DrawString(GUI.Font, character.ClosestCharacter.Info.Name, textPos + new Vector2(1, -1), Color.Orange); + GUI.DrawString(spriteBatch, textPos, character.ClosestCharacter.Info.Name, Color.Orange, Color.Black, 2); + + //spriteBatch.DrawString(GUI.Font, character.ClosestCharacter.Info.Name, textPos, Color.Black); + //spriteBatch.DrawString(GUI.Font, character.ClosestCharacter.Info.Name, textPos + new Vector2(1, -1), Color.Orange); } else if (character.SelectedCharacter == null && character.ClosestItem != null && character.SelectedConstruction == null) { @@ -71,19 +72,24 @@ namespace Barotrauma startPos = cam.WorldToScreen(startPos); Vector2 textPos = startPos; + textPos -= new Vector2(GUI.Font.MeasureString(character.ClosestItem.Name).X / 2, 20); + //spriteBatch.DrawString(GUI.Font, character.ClosestItem.Prefab.Name, textPos, Color.Black); + //GUI.DrawRectangle(spriteBatch, textPos-Vector2.One*2.0f, textSize+Vector2.One*4.0f, Color.Black * 0.7f, true); + //spriteBatch.DrawString(GUI.Font, character.ClosestItem.Prefab.Name, textPos, Color.Orange); + + GUI.DrawString(spriteBatch, textPos, character.ClosestItem.Name, Color.Orange, Color.Black * 0.7f, 2); - float stringWidth = GUI.Font.MeasureString(character.ClosestItem.Prefab.Name).X; - textPos -= new Vector2(stringWidth / 2, 20); - spriteBatch.DrawString(GUI.Font, character.ClosestItem.Prefab.Name, textPos, Color.Black); - spriteBatch.DrawString(GUI.Font, character.ClosestItem.Prefab.Name, textPos + new Vector2(1, -1), Color.Orange); textPos.Y += 50.0f; foreach (ColoredText coloredText in character.ClosestItem.GetHUDTexts(character)) { textPos.X = startPos.X - GUI.Font.MeasureString(coloredText.Text).X / 2; - spriteBatch.DrawString(GUI.Font, coloredText.Text, textPos, Color.Black); - spriteBatch.DrawString(GUI.Font, coloredText.Text, textPos + new Vector2(1, -1), coloredText.Color); + GUI.DrawString(spriteBatch, textPos, coloredText.Text, coloredText.Color, Color.Black*0.7f, 2); + + //spriteBatch.DrawString(GUI.Font, coloredText.Text, textPos, Color.Black); + //GUI.DrawRectangle(spriteBatch, textPos - Vector2.One * 2.0f, textSize + Vector2.One * 4.0f, Color.Black * 0.7f, true); + //spriteBatch.DrawString(GUI.Font, coloredText.Text, textPos, coloredText.Color); textPos.Y += 25; } diff --git a/Subsurface/Source/GUI/GUI.cs b/Subsurface/Source/GUI/GUI.cs index 45bc4b489..41bb503cb 100644 --- a/Subsurface/Source/GUI/GUI.cs +++ b/Subsurface/Source/GUI/GUI.cs @@ -15,7 +15,7 @@ namespace Barotrauma Center = (CenterX | CenterY), BottomRight = (Bottom | Right), BottomLeft = (Bottom | Left), BottomCenter = (CenterX | Bottom) } - + public class GUI { public static GUIStyle Style; @@ -42,7 +42,7 @@ namespace Barotrauma GUI.SmallFont = ToolBox.TryLoadFont("SmallFont", content); GUI.LargeFont = ToolBox.TryLoadFont("LargeFont", content); - cursor = new Sprite("Content/UI/cursor.png" ,Vector2.Zero); + cursor = new Sprite("Content/UI/cursor.png", Vector2.Zero); } public static bool PauseMenuOpen @@ -63,7 +63,7 @@ namespace Barotrauma // create 1x1 texture for line drawing t = new Texture2D(graphicsDevice, 1, 1); t.SetData(new Color[] { Color.White });// fill the texture with white - + Style = new GUIStyle("Content/UI/style.xml"); } @@ -75,18 +75,18 @@ namespace Barotrauma if (pauseMenuOpen) { - pauseMenu = new GUIFrame(new Rectangle(0,0,200,300), null, Alignment.Center, Style); + pauseMenu = new GUIFrame(new Rectangle(0, 0, 200, 300), null, Alignment.Center, Style); int y = 0; var button = new GUIButton(new Rectangle(0, y, 0, 30), "Resume", Alignment.CenterX, GUI.Style, pauseMenu); button.OnClicked = TogglePauseMenu; y += 60; - - if (Screen.Selected == GameMain.GameScreen && GameMain.GameSession !=null) + + if (Screen.Selected == GameMain.GameScreen && GameMain.GameSession != null) { SinglePlayerMode spMode = GameMain.GameSession.gameMode as SinglePlayerMode; - if (spMode!=null) + if (spMode != null) { button = new GUIButton(new Rectangle(0, y, 0, 30), "Load previous", Alignment.CenterX, GUI.Style, pauseMenu); button.OnClicked += TogglePauseMenu; @@ -95,7 +95,7 @@ namespace Barotrauma y += 60; } } - + if (Screen.Selected == GameMain.LobbyScreen) { SinglePlayerMode spMode = GameMain.GameSession.gameMode as SinglePlayerMode; @@ -111,7 +111,7 @@ namespace Barotrauma } - button = new GUIButton(new Rectangle(0, y, 0, 30), "Quit", Alignment.CenterX, GUI.Style, pauseMenu); + button = new GUIButton(new Rectangle(0, y, 0, 30), "Quit", Alignment.CenterX, GUI.Style, pauseMenu); button.OnClicked += QuitClicked; button.OnClicked += TogglePauseMenu; } @@ -132,7 +132,7 @@ namespace Barotrauma SaveUtil.SaveGame(GameMain.GameSession.SaveFile); } - if (GameMain.NetworkMember!=null) + if (GameMain.NetworkMember != null) { GameMain.NetworkMember.Disconnect(); GameMain.NetworkMember = null; @@ -149,7 +149,7 @@ namespace Barotrauma Vector2 edge = end - start; // calculate angle to rotate line float angle = (float)Math.Atan2(edge.Y, edge.X); - + sb.Draw(t, new Rectangle(// rectangle defines shape of line and position of start of line (int)start.X, @@ -163,6 +163,16 @@ namespace Barotrauma SpriteEffects.None, depth); } + + public static void DrawString(SpriteBatch sb, Vector2 pos, string text, Color color, Color? backgroundColor=null, int backgroundPadding=0, SpriteFont font = null) + { + if (font == null) font = GUI.Font; + sb.DrawString(font, text, pos, color); + if (backgroundColor == null) return; + + Vector2 textSize = font.MeasureString(text); + DrawRectangle(sb, pos - Vector2.One*backgroundPadding, textSize + Vector2.One * 2.0f * backgroundPadding, (Color)backgroundColor, true); + } public static void DrawRectangle(SpriteBatch sb, Vector2 start, Vector2 size, Color clr, bool isFilled = false, float depth = 0.0f) { diff --git a/Subsurface/Source/Screens/LobbyScreen.cs b/Subsurface/Source/Screens/LobbyScreen.cs index 1e0d3d971..f0285b0db 100644 --- a/Subsurface/Source/Screens/LobbyScreen.cs +++ b/Subsurface/Source/Screens/LobbyScreen.cs @@ -19,7 +19,8 @@ namespace Barotrauma private GUIListBox characterList, hireList; - private GUIListBox selectedItemList, itemList; + private GUIListBox selectedItemList; + private GUIListBox[] storeItemLists; private SinglePlayerMode gameMode; @@ -135,18 +136,27 @@ namespace Barotrauma var costText = new GUITextBlock(new Rectangle(0, 0, 100, 25), "Cost: ", GUI.Style, Alignment.BottomLeft, Alignment.TopLeft, bottomPanel[(int)PanelTab.Store]); costText.TextGetter = CostTextGetter; - buyButton = new GUIButton(new Rectangle(sellColumnWidth+20, 0, 100, 25), "Buy", Alignment.Bottom, GUI.Style, bottomPanel[(int)PanelTab.Store]); + buyButton = new GUIButton(new Rectangle(sellColumnWidth + 20, 0, 100, 25), "Buy", Alignment.Bottom, GUI.Style, bottomPanel[(int)PanelTab.Store]); buyButton.OnClicked = BuyItems; - itemList = new GUIListBox(new Rectangle(0, 0, sellColumnWidth, 400), Color.White * 0.7f, Alignment.TopRight, GUI.Style, bottomPanel[(int)PanelTab.Store]); - itemList.OnSelected = SelectItem; - - foreach (MapEntityPrefab ep in MapEntityPrefab.list) + + storeItemLists = new GUIListBox[Enum.GetValues(typeof(MapEntityCategory)).Length]; + + foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory))) { - if (ep.Price == 0) continue; + storeItemLists[(int)category] = new GUIListBox(new Rectangle(0, 0, sellColumnWidth, 400), Color.White * 0.7f, Alignment.TopRight, GUI.Style, bottomPanel[(int)PanelTab.Store]); + storeItemLists[(int)category].OnSelected = SelectItem; + storeItemLists[(int)category].UserData = category; + bottomPanel[(int)PanelTab.Store].RemoveChild(storeItemLists[(int)category]); - CreateItemFrame(ep, itemList); + foreach (MapEntityPrefab ep in MapEntityPrefab.list) + { + if (ep.Price == 0 || ep.Category != category) continue; + + CreateItemFrame(ep, storeItemLists[(int)category]); + } } + } public override void Select() @@ -413,6 +423,18 @@ namespace Barotrauma return true; } + private bool SelectItemCategory(GUIButton button, object selection) + { + + if (!(selection is MapEntityCategory)) return false; + var existingList = bottomPanel[(int)PanelTab.Store].children.Find(c => c.UserData is MapEntityCategory); + if (existingList != null) bottomPanel[(int)PanelTab.Store].RemoveChild(existingList); + + bottomPanel[(int)PanelTab.Store].AddChild(storeItemLists[(int)selection]); + + return true; + } + private string GetMoney() { return "Money: " + ((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", CrewManager.Money)) + " credits";