diff --git a/Subsurface/Content/Items/Electricity/monitors.xml b/Subsurface/Content/Items/Electricity/monitors.xml index e68bf4082..2ec8eeb98 100644 --- a/Subsurface/Content/Items/Electricity/monitors.xml +++ b/Subsurface/Content/Items/Electricity/monitors.xml @@ -14,6 +14,6 @@ \ No newline at end of file diff --git a/Subsurface/Content/Items/Electricity/poweritems.xml b/Subsurface/Content/Items/Electricity/poweritems.xml index 3a63ab3ef..bc2d764bc 100644 --- a/Subsurface/Content/Items/Electricity/poweritems.xml +++ b/Subsurface/Content/Items/Electricity/poweritems.xml @@ -17,7 +17,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -74,7 +74,7 @@ - + diff --git a/Subsurface/Content/Items/Electricity/signalitems.xml b/Subsurface/Content/Items/Electricity/signalitems.xml index 09f7c6bc2..597fce51b 100644 --- a/Subsurface/Content/Items/Electricity/signalitems.xml +++ b/Subsurface/Content/Items/Electricity/signalitems.xml @@ -224,7 +224,7 @@ - + diff --git a/Subsurface/Content/Items/Engine/engine.xml b/Subsurface/Content/Items/Engine/engine.xml index eeac7b92a..3d3ff81b5 100644 --- a/Subsurface/Content/Items/Engine/engine.xml +++ b/Subsurface/Content/Items/Engine/engine.xml @@ -18,7 +18,7 @@ - + @@ -45,7 +45,7 @@ - + @@ -72,12 +72,12 @@ - + - + @@ -107,7 +107,7 @@ - + diff --git a/Subsurface/Content/Items/Fabricators/fabricators.xml b/Subsurface/Content/Items/Fabricators/fabricators.xml index a1917ba3d..f3f5e6952 100644 --- a/Subsurface/Content/Items/Fabricators/fabricators.xml +++ b/Subsurface/Content/Items/Fabricators/fabricators.xml @@ -11,7 +11,7 @@ - + @@ -92,7 +92,7 @@ - + @@ -166,7 +166,7 @@ - + diff --git a/Subsurface/Content/Items/MiniMap/item.xml b/Subsurface/Content/Items/MiniMap/item.xml index b2aa8fc54..b4cea1c25 100644 --- a/Subsurface/Content/Items/MiniMap/item.xml +++ b/Subsurface/Content/Items/MiniMap/item.xml @@ -8,7 +8,7 @@ - + diff --git a/Subsurface/Content/Items/Pump/pump.xml b/Subsurface/Content/Items/Pump/pump.xml index 4085b29b2..9b957be14 100644 --- a/Subsurface/Content/Items/Pump/pump.xml +++ b/Subsurface/Content/Items/Pump/pump.xml @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ - + diff --git a/Subsurface/Content/Items/Reactor/reactor.xml b/Subsurface/Content/Items/Reactor/reactor.xml index 5d2d99079..fd01c2165 100644 --- a/Subsurface/Content/Items/Reactor/reactor.xml +++ b/Subsurface/Content/Items/Reactor/reactor.xml @@ -22,7 +22,7 @@ - + diff --git a/Subsurface/Content/Items/Tools/tools.xml b/Subsurface/Content/Items/Tools/tools.xml index 6df87404d..e8ae3ced0 100644 --- a/Subsurface/Content/Items/Tools/tools.xml +++ b/Subsurface/Content/Items/Tools/tools.xml @@ -201,7 +201,7 @@ - + diff --git a/Subsurface/Content/UI/UI_Atlas.png b/Subsurface/Content/UI/UI_Atlas.png index 11b7ac806..94c56f434 100644 Binary files a/Subsurface/Content/UI/UI_Atlas.png and b/Subsurface/Content/UI/UI_Atlas.png differ diff --git a/Subsurface/Content/UI/style.xml b/Subsurface/Content/UI/style.xml index 2ffc1526e..5bf34e948 100644 --- a/Subsurface/Content/UI/style.xml +++ b/Subsurface/Content/UI/style.xml @@ -114,6 +114,17 @@ + + + + + + - + - - + + + + + + \ No newline at end of file diff --git a/Subsurface/Source/Characters/AI/CrewCommander.cs b/Subsurface/Source/Characters/AI/CrewCommander.cs index be4e10420..a753ae295 100644 --- a/Subsurface/Source/Characters/AI/CrewCommander.cs +++ b/Subsurface/Source/Characters/AI/CrewCommander.cs @@ -52,7 +52,7 @@ namespace Barotrauma private void CreateGUIFrame() { - frame = new GUIFrame(Rectangle.Empty, Color.Black * 0.6f); + frame = new GUIFrame(Rectangle.Empty, Color.Black * 0.6f, null); frame.Padding = new Vector4(200.0f, 100.0f, 200.0f, 100.0f); GUIButton closeButton = new GUIButton(new Rectangle(0, 50, 100, 20), "Close", Alignment.BottomCenter, "", frame); @@ -110,12 +110,12 @@ namespace Barotrauma private GUIButton CreateOrderButton(Rectangle rect, Order order, bool createSymbol = true) { - var orderButton = new GUIButton(rect, order.Name, Color.Black * 0.7f, Alignment.TopCenter, Alignment.Center, null, frame); + var orderButton = new GUIButton(rect, order.Name, null, Alignment.TopCenter, Alignment.Center, "GUITextBox", frame); orderButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); - orderButton.TextColor = Color.White; + /*orderButton.TextColor = Color.White; orderButton.Color = Color.Black * 0.5f; orderButton.HoverColor = Color.LightGray * 0.5f; - orderButton.OutlineColor = Color.LightGray * 0.8f; + orderButton.OutlineColor = Color.LightGray * 0.8f;*/ orderButton.UserData = order; orderButton.OnClicked = SetOrder; @@ -169,15 +169,15 @@ namespace Barotrauma int x = startX + (150 + spacing) * (i % Math.Min(charactersPerRow, aliveCharacters.Count)); int y = (105 + spacing)*((int)Math.Floor((double)i / charactersPerRow)); - GUIButton characterButton = new GUIButton(new Rectangle(x+75, y, 150, 40), "", Color.Black, Alignment.TopCenter, null, frame); + GUIButton characterButton = new GUIButton(new Rectangle(x+75, y, 150, 40), "", null, Alignment.TopCenter, "GUITextBox", frame); characterButton.UserData = character; characterButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); - characterButton.Color = Character.Controlled == character ? Color.Gold * 0.2f : Color.Black * 0.5f; - characterButton.HoverColor = Color.LightGray * 0.5f; + characterButton.Color = Character.Controlled == character ? Color.Gold : Color.White; + /*characterButton.HoverColor = Color.LightGray * 0.5f; characterButton.SelectedColor = Color.Gold * 0.6f; - characterButton.OutlineColor = Color.LightGray * 0.8f; + characterButton.OutlineColor = Color.LightGray * 0.8f;*/ characterFrameBottom = Math.Max(characterFrameBottom, characterButton.Rect.Bottom); @@ -187,9 +187,9 @@ namespace Barotrauma GUITextBlock textBlock = new GUITextBlock( new Rectangle(40, 0, 0, 25), name, - Color.Transparent, Color.White, + Color.Transparent, null, Alignment.Left, Alignment.Left, - null, characterButton, false); + "", characterButton, false); textBlock.Font = GUI.SmallFont; textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f); @@ -259,8 +259,8 @@ namespace Barotrauma var existingOrder = characterFrame.children.Find(c => c.UserData is Order); if (existingOrder != null) characterFrame.RemoveChild(existingOrder); - var orderFrame = new GUIFrame(new Rectangle(-5, characterFrame.Rect.Height, characterFrame.Rect.Width, 30 + order.Options.Length * 15), null, characterFrame); - orderFrame.OutlineColor = Color.LightGray * 0.5f; + var orderFrame = new GUIFrame(new Rectangle(-5, characterFrame.Rect.Height, characterFrame.Rect.Width, 30 + order.Options.Length * 15), "InnerFrame", characterFrame); + /*orderFrame.OutlineColor = Color.LightGray * 0.5f;*/ orderFrame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); orderFrame.UserData = order; @@ -269,18 +269,14 @@ namespace Barotrauma img.Color = order.Color; img.CanBeFocused = false; - new GUITextBlock(new Rectangle(0, 0, 0, 20), order.DoingText, "", Alignment.TopLeft, Alignment.TopCenter, orderFrame); - - - - - + new GUITextBlock(new Rectangle(img.Rect.Width, 0, 0, 20), order.DoingText, "", Alignment.TopLeft, Alignment.CenterLeft, orderFrame); + var optionList = new GUIListBox(new Rectangle(0, 20, 0, 80), Color.Transparent, null, orderFrame); optionList.UserData = order; for (int i = 0; i < order.Options.Length; i++ ) { - var optionBox = new GUITextBlock(new Rectangle(0, 0, 0, 15), order.Options[i], "", optionList); + var optionBox = new GUITextBlock(new Rectangle(0, 0, 0, 15), order.Options[i], "", Alignment.TopLeft, Alignment.CenterLeft, optionList); optionBox.Font = GUI.SmallFont; optionBox.UserData = order.Options[i]; diff --git a/Subsurface/Source/Characters/CharacterInfo.cs b/Subsurface/Source/Characters/CharacterInfo.cs index ad2d7e4bb..bb1e1c2b2 100644 --- a/Subsurface/Source/Characters/CharacterInfo.cs +++ b/Subsurface/Source/Characters/CharacterInfo.cs @@ -254,14 +254,9 @@ namespace Barotrauma public GUIFrame CreateCharacterFrame(GUIComponent parent, string text, object userData) { - GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, null, parent); + GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, "ListBoxElement", parent); frame.UserData = userData; - frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); - frame.HoverColor = Color.LightGray * 0.5f; - frame.SelectedColor = Color.Gold * 0.5f; - - // string name = character.Info.Name.Replace(' ', '\n'); - + GUITextBlock textBlock = new GUITextBlock( new Rectangle(40, 0, 0, 25), text, diff --git a/Subsurface/Source/GUI/GUIListBox.cs b/Subsurface/Source/GUI/GUIListBox.cs index c608c2447..fcd69bd01 100644 --- a/Subsurface/Source/GUI/GUIListBox.cs +++ b/Subsurface/Source/GUI/GUIListBox.cs @@ -151,7 +151,7 @@ namespace Barotrauma scrollBar.IsHorizontal = isHorizontal; frame = new GUIFrame(Rectangle.Empty, style, this); - GUI.Style.Apply(frame, "", this); + if (style != null) GUI.Style.Apply(frame, style, this); UpdateScrollBarSize(); diff --git a/Subsurface/Source/GUI/GUIProgressBar.cs b/Subsurface/Source/GUI/GUIProgressBar.cs index c711506d4..b3277d047 100644 --- a/Subsurface/Source/GUI/GUIProgressBar.cs +++ b/Subsurface/Source/GUI/GUIProgressBar.cs @@ -56,7 +56,7 @@ namespace Barotrauma frame = new GUIFrame(new Rectangle(0, 0, 0, 0), null, this); GUI.Style.Apply(frame, "", this); - slider = new GUIFrame(new Rectangle(0, 0, 0, 0), null, this); + slider = new GUIFrame(new Rectangle(0, 0, 0, 0), null); GUI.Style.Apply(slider, "Slider", this); this.barSize = barSize; @@ -95,7 +95,30 @@ namespace Barotrauma DrawChildren(spriteBatch); - //GUI.DrawRectangle(spriteBatch, rect, color * (color.A / 255.0f), true); + Color currColor = color; + if (state == ComponentState.Selected) currColor = selectedColor; + if (state == ComponentState.Hover) currColor = hoverColor; + + if (slider.sprites != null && slider.sprites[state].Count > 0) + { + foreach (UISprite uiSprite in slider.sprites[state]) + { + if (uiSprite.Tile) + { + uiSprite.Sprite.DrawTiled(spriteBatch, slider.Rect.Location.ToVector2(), slider.Rect.Size.ToVector2(), currColor); + } + else + { + spriteBatch.Draw(uiSprite.Sprite.Texture, + slider.Rect, new Rectangle( + uiSprite.Sprite.SourceRect.X, + uiSprite.Sprite.SourceRect.Y, + (int)(uiSprite.Sprite.SourceRect.Width * (isHorizontal ? barSize : 1.0f)), + (int)(uiSprite.Sprite.SourceRect.Height * (isHorizontal ? 1.0f : barSize))), + currColor); + } + } + } } } diff --git a/Subsurface/Source/GameSession/CrewManager.cs b/Subsurface/Source/GameSession/CrewManager.cs index 891f94fb8..76b5ef171 100644 --- a/Subsurface/Source/GameSession/CrewManager.cs +++ b/Subsurface/Source/GameSession/CrewManager.cs @@ -38,6 +38,7 @@ namespace Barotrauma characterInfos = new List(); guiFrame = new GUIFrame(new Rectangle(0, 50, 150, 450), Color.Transparent); + guiFrame.Padding = Vector4.One * 5.0f; listBox = new GUIListBox(new Rectangle(45, 30, 150, 0), Color.Transparent, null, guiFrame); listBox.ScrollBarEnabled = false; @@ -128,33 +129,14 @@ namespace Barotrauma { commander.UpdateCharacters(); } - - + character.Info.CreateCharacterFrame(listBox, character.Info.Name.Replace(' ', '\n'), character); - GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 40, 40), Color.Transparent, null, orderListBox); - frame.UserData = character; - //frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); - frame.HoverColor = Color.LightGray * 0.5f; - frame.SelectedColor = Color.Gold * 0.5f; + GUIFrame orderFrame = new GUIFrame(new Rectangle(0, 0, 40, 40), Color.Transparent, "ListBoxElement", orderListBox); + orderFrame.UserData = character; var ai = character.AIController as HumanAIController; SetCharacterOrder(character, ai.CurrentOrder); - - - - //string name = character.Info.Name.Replace(' ', '\n'); - - //GUITextBlock textBlock = new GUITextBlock( - // new Rectangle(40, 0, 0, 25), - // name, - // Color.Transparent, Color.White, - // Alignment.Left, Alignment.Left, - // null, frame, false); - //textBlock.Font = GUI.SmallFont; - //textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f); - - //new GUIImage(new Rectangle(-10, -5, 0, 0), character.AnimController.Limbs[0].sprite, Alignment.Left, frame); } public void AddToGUIUpdateList() diff --git a/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs b/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs index c4e740509..43c497dec 100644 --- a/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs +++ b/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs @@ -56,7 +56,7 @@ namespace Barotrauma CargoManager = new CargoManager(); - endShiftButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 220, 20, 200, 25), "End shift", Alignment.TopLeft, ""); + endShiftButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 220, 20, 200, 25), "End shift", null, Alignment.TopLeft, Alignment.Center, ""); endShiftButton.Font = GUI.SmallFont; endShiftButton.OnClicked = TryEndShift; diff --git a/Subsurface/Source/Items/Components/ItemComponent.cs b/Subsurface/Source/Items/Components/ItemComponent.cs index a874a848e..31b6cbcfe 100644 --- a/Subsurface/Source/Items/Components/ItemComponent.cs +++ b/Subsurface/Source/Items/Components/ItemComponent.cs @@ -8,7 +8,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Barotrauma.Networking; using System.IO; -using System.Globalization; namespace Barotrauma.Items.Components { @@ -292,6 +291,8 @@ namespace Barotrauma.Items.Components if (components[1].Contains(".")) rect.Y *= GameMain.GraphicsHeight; if (components[2].Contains(".")) rect.Z *= GameMain.GraphicsWidth; if (components[3].Contains(".")) rect.W *= GameMain.GraphicsHeight; + + string style = ToolBox.GetAttributeString(subElement, "style", ""); Vector4 color = ToolBox.GetAttributeVector4(subElement, "color", Vector4.One); @@ -307,9 +308,9 @@ namespace Barotrauma.Items.Components } guiFrame = new GUIFrame( - new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Z, (int)rect.W), - new Color(color.X, color.Y, color.Z) * color.W, alignment, ""); - //guiFrame.Alpha = color.W; + new Rectangle((int)rect.X, (int)rect.Y, (int)rect.Z, (int)rect.W), + new Color(color.X, color.Y, color.Z) * color.W, + alignment, style); break; case "sound": diff --git a/Subsurface/Source/Items/Components/Machines/Radar.cs b/Subsurface/Source/Items/Components/Machines/Radar.cs index 06b99230b..661f7de83 100644 --- a/Subsurface/Source/Items/Components/Machines/Radar.cs +++ b/Subsurface/Source/Items/Components/Machines/Radar.cs @@ -114,7 +114,7 @@ namespace Barotrauma.Items.Components public override void DrawHUD(SpriteBatch spriteBatch, Character character) { GuiFrame.Draw(spriteBatch); - + if (voltage < minVoltage && powerConsumption > 0.0f) return; int radius = GuiFrame.Rect.Height / 2 - 30; diff --git a/Subsurface/Source/Map/MapEntity.cs b/Subsurface/Source/Map/MapEntity.cs index 147840fbb..3c0bbd5ca 100644 --- a/Subsurface/Source/Map/MapEntity.cs +++ b/Subsurface/Source/Map/MapEntity.cs @@ -657,10 +657,8 @@ namespace Barotrauma highlightedListBox = new GUIListBox( new Rectangle((int)PlayerInput.MousePosition.X+15, (int)PlayerInput.MousePosition.Y+15, 150, highlightedEntities.Count * 15), - null, Alignment.TopLeft, "", null, false); - - highlightedListBox.Color = Color.Black * 0.6f; - + null, Alignment.TopLeft, "GUIToolTip", null, false); + foreach (MapEntity entity in highlightedEntities) { var textBlock = new GUITextBlock( diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs index 29a39a744..f914c04a7 100644 --- a/Subsurface/Source/Networking/GameServer.cs +++ b/Subsurface/Source/Networking/GameServer.cs @@ -1340,8 +1340,8 @@ namespace Barotrauma.Networking clientInfo = new GUIFrame(new Rectangle(0, 0, 180, 0), Color.Transparent, Alignment.TopRight, null, clientNameBox); clientInfo.UserData = client.FileStreamSender; - new GUIProgressBar(new Rectangle(0, 4, 160, clientInfo.Rect.Height - 8), Color.Green, "", 0.0f, Alignment.Left, clientInfo).IsHorizontal = true; - new GUITextBlock(new Rectangle(0, 2, 160, 0), "", "", Alignment.TopLeft, Alignment.Left | Alignment.CenterY, clientInfo, true, GUI.SmallFont); + new GUIProgressBar(new Rectangle(0, 4, 160, clientInfo.Rect.Height - 8), Color.White, "", 0.0f, Alignment.Left, clientInfo).IsHorizontal = true; + new GUITextBlock(new Rectangle(0, 2, 160, 0), "", "", Alignment.Center, Alignment.Center, clientInfo, true, GUI.SmallFont); var cancelButton = new GUIButton(new Rectangle(20, 0, 14, 0), "X", Alignment.Right, "", clientInfo); cancelButton.OnClicked = (GUIButton button, object userdata) =>