diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index 1e1be8458..3e1f566f6 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -1084,12 +1084,12 @@ namespace Barotrauma for (int i = 0; i < 10; i++) { Particle p = GameMain.ParticleManager.CreateParticle("waterblood", - ConvertUnits.ToDisplayUnits(centerOfMass) + Rand.Vector(50.0f), - Vector2.Zero); + ConvertUnits.ToDisplayUnits(centerOfMass) + Rand.Vector(5.0f), + Rand.Vector(10.0f)); if (p!=null) p.Size *= 2.0f; GameMain.ParticleManager.CreateParticle("bubbles", - ConvertUnits.ToDisplayUnits(centerOfMass) + Rand.Vector(50.0f), + ConvertUnits.ToDisplayUnits(centerOfMass) + Rand.Vector(5.0f), new Vector2(Rand.Range(-50f, 50f), Rand.Range(-100f,50f))); } diff --git a/Subsurface/Source/GUI/GUI.cs b/Subsurface/Source/GUI/GUI.cs index 41bb503cb..b6d151ad2 100644 --- a/Subsurface/Source/GUI/GUI.cs +++ b/Subsurface/Source/GUI/GUI.cs @@ -166,12 +166,15 @@ namespace Barotrauma 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); + if (font == null) font = GUI.Font; + if (backgroundColor != null) + { + Vector2 textSize = font.MeasureString(text); + DrawRectangle(sb, pos - Vector2.One * backgroundPadding, textSize + Vector2.One * 2.0f * backgroundPadding, (Color)backgroundColor, true); + } + + sb.DrawString(font, text, pos, color); } public static void DrawRectangle(SpriteBatch sb, Vector2 start, Vector2 size, Color clr, bool isFilled = false, float depth = 0.0f) diff --git a/Subsurface/Source/Items/Components/Machines/Radar.cs b/Subsurface/Source/Items/Components/Machines/Radar.cs index 3f647db3c..70ef05a08 100644 --- a/Subsurface/Source/Items/Components/Machines/Radar.cs +++ b/Subsurface/Source/Items/Components/Machines/Radar.cs @@ -97,7 +97,7 @@ namespace Barotrauma.Items.Components item.NewComponentEvent(this, true, false); } - int radius = GuiFrame.Rect.Height / 2 - 10; + int radius = GuiFrame.Rect.Height / 2 - 30; DrawRadar(spriteBatch, new Rectangle((int)GuiFrame.Center.X - radius, (int)GuiFrame.Center.Y - radius, radius * 2, radius * 2)); //voltage = 0.0f; diff --git a/Subsurface/Source/Map/Lights/LightManager.cs b/Subsurface/Source/Map/Lights/LightManager.cs index f69cff20c..e2d905acf 100644 --- a/Subsurface/Source/Map/Lights/LightManager.cs +++ b/Subsurface/Source/Map/Lights/LightManager.cs @@ -141,7 +141,7 @@ namespace Barotrauma.Lights foreach (LightSource light in lights) { if (light.hullsInRange.Count > 0 || light.Color.A < 0.01f || light.Range < 1.0f) continue; - if (!MathUtils.CircleIntersectsRectangle(light.Position, light.Range, viewRect)) continue; + if (!MathUtils.CircleIntersectsRectangle(light.WorldPosition, light.Range, viewRect)) continue; light.Draw(spriteBatch); } diff --git a/Subsurface/Source/Map/Lights/LightSource.cs b/Subsurface/Source/Map/Lights/LightSource.cs index 0eb9fee15..f0194a173 100644 --- a/Subsurface/Source/Map/Lights/LightSource.cs +++ b/Subsurface/Source/Map/Lights/LightSource.cs @@ -68,7 +68,7 @@ namespace Barotrauma.Lights { range = MathHelper.Clamp(value, 0.0f, 2048.0f); - if (Math.Abs(prevHullUpdateRange - range)>5.0f) return; + if (Math.Abs(prevHullUpdateRange - range)<5.0f) return; UpdateHullsInRange(); prevHullUpdateRange = range; diff --git a/Subsurface/Source/Screens/EditMapScreen.cs b/Subsurface/Source/Screens/EditMapScreen.cs index ee553c61e..5bf3778fd 100644 --- a/Subsurface/Source/Screens/EditMapScreen.cs +++ b/Subsurface/Source/Screens/EditMapScreen.cs @@ -95,7 +95,6 @@ namespace Barotrauma itemList.OnSelected = SelectPrefab; itemList.CheckSelected = MapEntityPrefab.GetSelected; - foreach (MapEntityPrefab ep in MapEntityPrefab.list) { if (ep.Category != category) continue; @@ -130,6 +129,9 @@ namespace Barotrauma img.Color = ep.SpriteColor; } } + + itemList.children.Sort((i1, i2) => (i1.UserData as MapEntityPrefab).Name.CompareTo((i2.UserData as MapEntityPrefab).Name)); + } diff --git a/Subsurface/Source/Screens/LobbyScreen.cs b/Subsurface/Source/Screens/LobbyScreen.cs index f0285b0db..f9a2044cd 100644 --- a/Subsurface/Source/Screens/LobbyScreen.cs +++ b/Subsurface/Source/Screens/LobbyScreen.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.Linq; using System.Collections.Generic; using System.Globalization; @@ -20,7 +21,7 @@ namespace Barotrauma private GUIListBox characterList, hireList; private GUIListBox selectedItemList; - private GUIListBox[] storeItemLists; + private GUIListBox storeItemList; private SinglePlayerMode gameMode; @@ -139,23 +140,23 @@ namespace Barotrauma buyButton = new GUIButton(new Rectangle(sellColumnWidth + 20, 0, 100, 25), "Buy", Alignment.Bottom, GUI.Style, bottomPanel[(int)PanelTab.Store]); buyButton.OnClicked = BuyItems; - - storeItemLists = new GUIListBox[Enum.GetValues(typeof(MapEntityCategory)).Length]; - + int x = selectedItemList.Rect.Width + 40; foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory))) { - 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]); + var items = MapEntityPrefab.list.FindAll(ep => ep.Price>0.0f && ep.Category == category); + if (!items.Any()) continue; - foreach (MapEntityPrefab ep in MapEntityPrefab.list) - { - if (ep.Price == 0 || ep.Category != category) continue; + var categoryButton = new GUIButton(new Rectangle(x, 0, 100, 20), category.ToString(), GUI.Style, bottomPanel[(int)PanelTab.Store]); + categoryButton.UserData = category; + categoryButton.OnClicked = SelectItemCategory; + x += 110; - CreateItemFrame(ep, storeItemLists[(int)category]); - } + storeItemList = new GUIListBox(new Rectangle(0, 30, sellColumnWidth, 400), Color.White * 0.7f, Alignment.TopRight, GUI.Style, bottomPanel[(int)PanelTab.Store]); + storeItemList.OnSelected = SelectItem; + storeItemList.UserData = category; } + + SelectItemCategory(null, MapEntityCategory.Item); } @@ -427,10 +428,22 @@ namespace Barotrauma { 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); + //var existingList = bottomPanel[(int)PanelTab.Store].children.Find(c => c is GUIListBox && c.UserData is MapEntityCategory); + //if (existingList != null) bottomPanel[(int)PanelTab.Store].RemoveChild(existingList); - bottomPanel[(int)PanelTab.Store].AddChild(storeItemLists[(int)selection]); + //bottomPanel[(int)PanelTab.Store].AddChild(storeItemLists[(int)selection]); + + storeItemList.ClearChildren(); + + MapEntityCategory category = (MapEntityCategory)selection; + var items = MapEntityPrefab.list.FindAll(ep => ep.Price > 0.0f && ep.Category == category); + + foreach (MapEntityPrefab ep in items) + { + CreateItemFrame(ep, storeItemList); + } + + storeItemList.children.Sort((x, y) => (x.UserData as MapEntityPrefab).Name.CompareTo((y.UserData as MapEntityPrefab).Name)); return true; } diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index a758957d4..5ab6d7781 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ