diff --git a/Launcher2/LauncherMain.cs b/Launcher2/LauncherMain.cs
index 491e3d6c2..a9c615350 100644
--- a/Launcher2/LauncherMain.cs
+++ b/Launcher2/LauncherMain.cs
@@ -107,7 +107,7 @@ namespace Launcher2
guiRoot = new GUIFrame(new Rectangle(0,0,graphicsWidth, graphicsHeight), Color.Transparent);
guiRoot.Padding = new Vector4(40.0f, 40.0f, 40.0f, 40.0f);
- launchButton = new GUIButton(new Rectangle(0,0,100,30), "START", Alignment.BottomRight, GUI.Style, guiRoot);
+ launchButton = new GUIButton(new Rectangle(0,0,100,30), "START", Alignment.BottomRight, "", guiRoot);
launchButton.OnClicked = LaunchClick;
int y = 50;
@@ -115,15 +115,15 @@ namespace Launcher2
var checkForUpdates = new GUITickBox(new Rectangle(0, y, 20, 20), "Automatically check for updates", Alignment.TopLeft, guiRoot);
checkForUpdates.Selected = settings.AutoCheckUpdates;
- updateInfoText = new GUITextBlock(new Rectangle(0,y+30,100,20), "", GUI.Style, guiRoot);
+ updateInfoText = new GUITextBlock(new Rectangle(0,y+30,100,20), "", "", guiRoot);
- updateInfoBox = new GUIListBox(new Rectangle(0, y + 55, 330, graphicsHeight-y-55-30-80), GUI.Style, guiRoot);
+ updateInfoBox = new GUIListBox(new Rectangle(0, y + 55, 330, graphicsHeight-y-55-30-80), "", guiRoot);
updateInfoBox.Visible = false;
progressBar = new GUIProgressBar(new Rectangle(110,0,220,20), Color.Green, 0.0f, Alignment.BottomLeft, guiRoot);
progressBar.Visible = false;
- downloadButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Download", Alignment.BottomLeft, GUI.Style, guiRoot);
+ downloadButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Download", Alignment.BottomLeft, "", guiRoot);
downloadButton.OnClicked = DownloadButtonClicked;
downloadButton.Visible = false;
@@ -131,8 +131,8 @@ namespace Launcher2
//-----------------------------------------------------------------
int x = 360;
- new GUITextBlock(new Rectangle(x, y, 20, 20), "Resolution", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, guiRoot);
- resolutionDD = new GUIDropDown(new Rectangle(x, y + 20, 200, 20), "", GUI.Style, guiRoot);
+ new GUITextBlock(new Rectangle(x, y, 20, 20), "Resolution", "", Alignment.TopLeft, Alignment.TopLeft, guiRoot);
+ resolutionDD = new GUIDropDown(new Rectangle(x, y + 20, 200, 20), "", "", guiRoot);
foreach (DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
{
@@ -149,8 +149,8 @@ namespace Launcher2
resolutionDD.SelectItem(GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.Last());
}
- new GUITextBlock(new Rectangle(x, y + 50, 20, 20), "Content package", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, guiRoot);
- contentPackageDD = new GUIDropDown(new Rectangle(x, y + 70, 200, 20), "", GUI.Style, guiRoot);
+ new GUITextBlock(new Rectangle(x, y + 50, 20, 20), "Content package", "", Alignment.TopLeft, Alignment.TopLeft, guiRoot);
+ contentPackageDD = new GUIDropDown(new Rectangle(x, y + 70, 200, 20), "", "", guiRoot);
foreach (ContentPackage contentPackage in ContentPackage.list)
{
@@ -161,8 +161,8 @@ namespace Launcher2
//new GUIButton(new Rectangle(x,y+120,150,20), "Package Manager", GUI.Style, guiRoot);
- new GUITextBlock(new Rectangle(x, y + 130, 20, 20), "Display mode", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, guiRoot);
- displayModeDD = new GUIDropDown(new Rectangle(x, y + 150, 200, 20), "", GUI.Style, guiRoot);
+ new GUITextBlock(new Rectangle(x, y + 130, 20, 20), "Display mode", "", Alignment.TopLeft, Alignment.TopLeft, guiRoot);
+ displayModeDD = new GUIDropDown(new Rectangle(x, y + 150, 200, 20), "", "", guiRoot);
displayModeDD.AddItem("Fullscreen", WindowMode.Fullscreen);
displayModeDD.AddItem("Windowed", WindowMode.Windowed);
displayModeDD.AddItem("Borderless windowed", WindowMode.BorderlessWindowed);
@@ -310,7 +310,7 @@ namespace Launcher2
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(indent, 0, 0, heigth),
- line, GUI.Style,
+ line, "",
Alignment.TopLeft, Alignment.TopLeft,
updateInfoBox, true, GUI.SmallFont);
textBlock.Padding = new Vector4(indent, 0, 0, 0);
@@ -551,7 +551,7 @@ namespace Launcher2
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 17),
- "Downloading " + filesToDownload[filesDownloaded] + "...", GUI.Style,
+ "Downloading " + filesToDownload[filesDownloaded] + "...", "",
Alignment.TopLeft, Alignment.TopLeft,
updateInfoBox, false, GUI.SmallFont);
textBlock.CanBeFocused = false;
@@ -591,7 +591,7 @@ namespace Launcher2
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 0),
- errorMsg, GUI.Style,
+ errorMsg, "",
Alignment.TopLeft, Alignment.TopLeft,
updateInfoBox, true, GUI.SmallFont);
textBlock.TextColor = Color.Red;
diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj
index adfef498b..2eb25ca99 100644
--- a/Subsurface/Barotrauma.csproj
+++ b/Subsurface/Barotrauma.csproj
@@ -1060,6 +1060,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
diff --git a/Subsurface/Barotrauma.csproj.user b/Subsurface/Barotrauma.csproj.user
index 1782abafa..df35fcf91 100644
--- a/Subsurface/Barotrauma.csproj.user
+++ b/Subsurface/Barotrauma.csproj.user
@@ -9,7 +9,7 @@
en-US
false
- ShowAllFiles
+ ProjectFiles
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
new file mode 100644
index 000000000..438bd4f0b
Binary files /dev/null and b/Subsurface/Content/UI/UI_Atlas.png differ
diff --git a/Subsurface/Content/UI/style.xml b/Subsurface/Content/UI/style.xml
index 31ba04d98..67040a865 100644
--- a/Subsurface/Content/UI/style.xml
+++ b/Subsurface/Content/UI/style.xml
@@ -1,70 +1,212 @@
\ No newline at end of file
diff --git a/Subsurface/Source/Characters/AI/CrewCommander.cs b/Subsurface/Source/Characters/AI/CrewCommander.cs
index 9f712422c..90eaf2da9 100644
--- a/Subsurface/Source/Characters/AI/CrewCommander.cs
+++ b/Subsurface/Source/Characters/AI/CrewCommander.cs
@@ -52,10 +52,10 @@ 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, GUI.Style, frame);
+ GUIButton closeButton = new GUIButton(new Rectangle(0, 50, 100, 20), "Close", Alignment.BottomCenter, "", frame);
closeButton.OnClicked = (GUIButton button, object userData) =>
{
ToggleGUIFrame();
@@ -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, GUI.Style, 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], GUI.Style, 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/CharacterHUD.cs b/Subsurface/Source/Characters/CharacterHUD.cs
index 2f7e2a6f1..8d1cd8572 100644
--- a/Subsurface/Source/Characters/CharacterHUD.cs
+++ b/Subsurface/Source/Characters/CharacterHUD.cs
@@ -154,7 +154,7 @@ namespace Barotrauma
if (cprButton == null)
{
cprButton = new GUIButton(
- new Rectangle(character.SelectedCharacter.Inventory.SlotPositions[0].ToPoint() + new Point(320, -30), new Point(130, 20)), "Perform CPR", GUI.Style);
+ new Rectangle(character.SelectedCharacter.Inventory.SlotPositions[0].ToPoint() + new Point(320, -30), new Point(130, 20)), "Perform CPR", "");
cprButton.OnClicked = (button, userData) =>
{
@@ -252,7 +252,7 @@ namespace Barotrauma
if (suicideButton == null)
{
suicideButton = new GUIButton(
- new Rectangle(new Point(GameMain.GraphicsWidth / 2 - 60, 20), new Point(120, 20)), "Give in", GUI.Style);
+ new Rectangle(new Point(GameMain.GraphicsWidth / 2 - 60, 20), new Point(120, 20)), "Give in", "");
suicideButton.ToolTip = GameMain.NetworkMember == null ?
@@ -287,10 +287,10 @@ namespace Barotrauma
{
int width = 100, height = 20;
- drowningBar = new GUIProgressBar(new Rectangle(30, GameMain.GraphicsHeight - 200, width, height), Color.Blue, GUI.Style, 1.0f, Alignment.TopLeft);
+ drowningBar = new GUIProgressBar(new Rectangle(30, GameMain.GraphicsHeight - 200, width, height), Color.Blue, "", 1.0f, Alignment.TopLeft);
new GUIImage(new Rectangle(-27, -7, 20, 20), new Rectangle(17, 0, 20, 24), statusIcons, Alignment.TopLeft, drowningBar);
- healthBar = new GUIProgressBar(new Rectangle(30, GameMain.GraphicsHeight - 230, width, height), Color.Red, GUI.Style, 1.0f, Alignment.TopLeft);
+ healthBar = new GUIProgressBar(new Rectangle(30, GameMain.GraphicsHeight - 230, width, height), Color.Red, "", 1.0f, Alignment.TopLeft);
new GUIImage(new Rectangle(-26, -7, 20, 20), new Rectangle(0, 0, 13, 24), statusIcons, Alignment.TopLeft, healthBar);
}
diff --git a/Subsurface/Source/Characters/CharacterInfo.cs b/Subsurface/Source/Characters/CharacterInfo.cs
index b29e93b75..f67043f6e 100644
--- a/Subsurface/Source/Characters/CharacterInfo.cs
+++ b/Subsurface/Source/Characters/CharacterInfo.cs
@@ -226,24 +226,24 @@ namespace Barotrauma
ScalableFont font = frame.Rect.Width<280 ? GUI.SmallFont : GUI.Font;
int x = 0, y = 0;
- new GUITextBlock(new Rectangle(x+60, y, 200, 20), Name, GUI.Style, frame, font);
+ new GUITextBlock(new Rectangle(x+60, y, 200, 20), Name, "", frame, font);
y += 20;
if (Job!=null)
{
- new GUITextBlock(new Rectangle(x + 60, y, 200, 20), Job.Name, GUI.Style, frame, font);
+ new GUITextBlock(new Rectangle(x + 60, y, 200, 20), Job.Name, "", frame, font);
y += 30;
var skills = Job.Skills;
skills.Sort((s1, s2) => -s1.Level.CompareTo(s2.Level));
- new GUITextBlock(new Rectangle(x, y, 200, 20), "Skills:", GUI.Style, frame, font);
+ new GUITextBlock(new Rectangle(x, y, 200, 20), "Skills:", "", frame, font);
y += 20;
foreach (Skill skill in skills)
{
Color textColor = Color.White * (0.5f + skill.Level/200.0f);
- new GUITextBlock(new Rectangle(x, y, 200, 20), skill.Name, Color.Transparent, textColor, Alignment.Left, GUI.Style, frame).Font = font;
- new GUITextBlock(new Rectangle(x, y, 200, 20), skill.Level.ToString(), Color.Transparent, textColor, Alignment.Right, GUI.Style, frame).Font = font;
+ new GUITextBlock(new Rectangle(x, y, 200, 20), skill.Name, Color.Transparent, textColor, Alignment.Left, "", frame).Font = font;
+ new GUITextBlock(new Rectangle(x, y, 200, 20), skill.Level.ToString(), Color.Transparent, textColor, Alignment.Right, "", frame).Font = font;
y += 20;
}
}
@@ -254,20 +254,15 @@ 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,
- Color.Transparent, Color.White,
+ null, null,
Alignment.Left, Alignment.Left,
- null, frame, false);
+ "", frame, false);
textBlock.Font = GUI.SmallFont;
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
diff --git a/Subsurface/Source/Characters/Jobs/JobPrefab.cs b/Subsurface/Source/Characters/Jobs/JobPrefab.cs
index 9965bade2..7fb814592 100644
--- a/Subsurface/Source/Characters/Jobs/JobPrefab.cs
+++ b/Subsurface/Source/Characters/Jobs/JobPrefab.cs
@@ -108,14 +108,14 @@ namespace Barotrauma
GUIFrame backFrame = new GUIFrame(Rectangle.Empty, Color.Black*0.5f);
- GUIFrame frame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style, backFrame);
+ GUIFrame frame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "", backFrame);
frame.Padding = new Vector4(30.0f, 30.0f, 30.0f, 30.0f);
- new GUITextBlock(new Rectangle(0,0,100,20), Name, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.LargeFont);
+ new GUITextBlock(new Rectangle(0,0,100,20), Name, "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.LargeFont);
- var descriptionBlock = new GUITextBlock(new Rectangle(0, 40, 0, 0), Description, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, frame, true, GUI.SmallFont);
+ var descriptionBlock = new GUITextBlock(new Rectangle(0, 40, 0, 0), Description, "", Alignment.TopLeft, Alignment.TopLeft, frame, true, GUI.SmallFont);
- new GUITextBlock(new Rectangle(0, 40 + descriptionBlock.Rect.Height + 20, 100, 20), "Skills: ", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.LargeFont);
+ new GUITextBlock(new Rectangle(0, 40 + descriptionBlock.Rect.Height + 20, 100, 20), "Skills: ", "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.LargeFont);
int y = 40 + descriptionBlock.Rect.Height + 50;
foreach (SkillPrefab skill in Skills)
@@ -128,18 +128,18 @@ namespace Barotrauma
skillDescription += "/"+skillDescription2;
}
new GUITextBlock(new Rectangle(0, y, 100, 20),
- " - " + skill.Name + ": " + skillDescription, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.SmallFont);
+ " - " + skill.Name + ": " + skillDescription, "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.SmallFont);
y += 20;
}
- new GUITextBlock(new Rectangle(250, 40 + descriptionBlock.Rect.Height + 20, 0, 20), "Items: ", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.LargeFont);
+ new GUITextBlock(new Rectangle(250, 40 + descriptionBlock.Rect.Height + 20, 0, 20), "Items: ", "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.LargeFont);
y = 40 + descriptionBlock.Rect.Height + 50;
foreach (string itemName in ItemNames)
{
new GUITextBlock(new Rectangle(250, y, 100, 20),
- " - " + itemName, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.SmallFont);
+ " - " + itemName, "", Alignment.TopLeft, Alignment.TopLeft, frame, false, GUI.SmallFont);
y += 20;
}
diff --git a/Subsurface/Source/DebugConsole.cs b/Subsurface/Source/DebugConsole.cs
index 9deb14d8c..a2bd77595 100644
--- a/Subsurface/Source/DebugConsole.cs
+++ b/Subsurface/Source/DebugConsole.cs
@@ -55,15 +55,14 @@ namespace Barotrauma
int x = 20, y = 20;
int width = 800, height = 500;
- frame = new GUIFrame(new Rectangle(x, y, width, height), new Color(0.4f, 0.4f, 0.4f, 0.5f));
- frame.Color = Color.White * 0.4f;
+ frame = new GUIFrame(new Rectangle(x, y, width, height), new Color(0.4f, 0.4f, 0.4f, 0.8f));
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, GUI.Style, frame);
- listBox.Color = Color.Black * 0.7f;
+ listBox = new GUIListBox(new Rectangle(0, 0, 0, frame.Rect.Height - 40), Color.Black, "", frame);
+ //listBox.Color = Color.Black * 0.7f;
- textBox = new GUITextBox(new Rectangle(0,0,0,20), Color.Black, Color.White, Alignment.BottomLeft, Alignment.Left, GUI.Style, frame);
- textBox.Color = Color.Black * 0.7f;
+ textBox = new GUITextBox(new Rectangle(0,0,0,20), Color.Black, Color.White, Alignment.BottomLeft, Alignment.Left, "", frame);
+ //textBox.Color = Color.Black * 0.7f;
//messages already added before initialization -> add them to the listbox
List unInitializedMessages = new List(Messages);
@@ -857,7 +856,7 @@ namespace Barotrauma
try
{
- var textBlock = new GUITextBlock(new Rectangle(0, 0, listBox.Rect.Width, 0), msg, GUI.Style, Alignment.TopLeft, Alignment.Left, null, true, GUI.SmallFont);
+ var textBlock = new GUITextBlock(new Rectangle(0, 0, listBox.Rect.Width, 0), msg, "", Alignment.TopLeft, Alignment.Left, null, true, GUI.SmallFont);
textBlock.CanBeFocused = false;
textBlock.TextColor = color;
diff --git a/Subsurface/Source/GUI/ComponentStyle.cs b/Subsurface/Source/GUI/ComponentStyle.cs
index d336cb812..57f11faf2 100644
--- a/Subsurface/Source/GUI/ComponentStyle.cs
+++ b/Subsurface/Source/GUI/ComponentStyle.cs
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
+using System;
using System.Collections.Generic;
using System.Xml.Linq;
@@ -18,6 +19,18 @@ namespace Barotrauma
private set;
}
+ public bool Slice
+ {
+ get;
+ set;
+ }
+
+ public Rectangle[] Slices
+ {
+ get;
+ set;
+ }
+
public bool MaintainAspectRatio
{
get;
@@ -45,14 +58,21 @@ namespace Barotrauma
public readonly Color OutlineColor;
- public readonly List Sprites;
+ public readonly Dictionary> Sprites;
public readonly bool TileSprites;
+ public Dictionary ChildStyles;
public GUIComponentStyle(XElement element)
{
- Sprites = new List();
+ Sprites = new Dictionary>();
+ foreach (GUIComponent.ComponentState state in Enum.GetValues(typeof(GUIComponent.ComponentState)))
+ {
+ Sprites[state] = new List();
+ }
+
+ ChildStyles = new Dictionary();
Padding = ToolBox.GetAttributeVector4(element, "padding", Vector4.Zero);
@@ -80,7 +100,47 @@ namespace Barotrauma
bool maintainAspect = ToolBox.GetAttributeBool(subElement, "maintainaspectratio",false);
bool tile = ToolBox.GetAttributeBool(subElement, "tile", true);
- Sprites.Add(new UISprite(sprite, tile, maintainAspect));
+ string stateStr = ToolBox.GetAttributeString(subElement, "state", "None");
+ GUIComponent.ComponentState spriteState = GUIComponent.ComponentState.None;
+ Enum.TryParse(stateStr, out spriteState);
+
+ UISprite newSprite = new UISprite(sprite, tile, maintainAspect);
+
+ Vector4 sliceVec = ToolBox.GetAttributeVector4(subElement, "slice", Vector4.Zero);
+ if (sliceVec != Vector4.Zero)
+ {
+ Rectangle slice = new Rectangle((int)sliceVec.X, (int)sliceVec.Y, (int)(sliceVec.Z - sliceVec.X), (int)(sliceVec.W - sliceVec.Y));
+
+ newSprite.Slice = true;
+
+ newSprite.Slices = new Rectangle[9];
+
+ //top-left
+ newSprite.Slices[0] = new Rectangle(newSprite.Sprite.SourceRect.Location, slice.Location - newSprite.Sprite.SourceRect.Location);
+ //top-mid
+ newSprite.Slices[1] = new Rectangle(slice.Location.X, newSprite.Slices[0].Y, slice.Width, newSprite.Slices[0].Height);
+ //top-right
+ newSprite.Slices[2] = new Rectangle(slice.Right, newSprite.Slices[0].Y, newSprite.Sprite.SourceRect.Right - slice.Right, newSprite.Slices[0].Height);
+
+ //mid-left
+ newSprite.Slices[3] = new Rectangle(newSprite.Slices[0].X, slice.Y, newSprite.Slices[0].Width, slice.Height);
+ //center
+ newSprite.Slices[4] = slice;
+ //mid-right
+ newSprite.Slices[5] = new Rectangle(newSprite.Slices[2].X, slice.Y, newSprite.Slices[2].Width, slice.Height);
+
+ //bottom-left
+ newSprite.Slices[6] = new Rectangle(newSprite.Slices[0].X, slice.Bottom, newSprite.Slices[0].Width, newSprite.Sprite.SourceRect.Bottom - slice.Bottom);
+ //bottom-mid
+ newSprite.Slices[7] = new Rectangle(newSprite.Slices[1].X, slice.Bottom, newSprite.Slices[1].Width, newSprite.Sprite.SourceRect.Bottom - slice.Bottom);
+ //bottom-right
+ newSprite.Slices[8] = new Rectangle(newSprite.Slices[2].X, slice.Bottom, newSprite.Slices[2].Width, newSprite.Sprite.SourceRect.Bottom - slice.Bottom);
+ }
+
+ Sprites[spriteState].Add(newSprite);
+ break;
+ default:
+ ChildStyles.Add(subElement.Name.ToString().ToLowerInvariant(), new GUIComponentStyle(subElement));
break;
}
}
diff --git a/Subsurface/Source/GUI/GUI.cs b/Subsurface/Source/GUI/GUI.cs
index 665a6d153..fca97836a 100644
--- a/Subsurface/Source/GUI/GUI.cs
+++ b/Subsurface/Source/GUI/GUI.cs
@@ -1,7 +1,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
@@ -10,10 +9,10 @@ namespace Barotrauma
[Flags]
public enum Alignment
{
- CenterX = 1, Left = 2, Right = 4, CenterY = 8, Top = 16, Bottom = 32 ,
- TopRight = (Top | Right), TopLeft = (Top | Left), TopCenter = (CenterX | Top),
- Center = (CenterX | CenterY),
- BottomRight = (Bottom | Right), BottomLeft = (Bottom | Left), BottomCenter = (CenterX | Bottom)
+ CenterX = 1, Left = 2, Right = 4, CenterY = 8, Top = 16, Bottom = 32,
+ TopLeft = (Top | Left), TopCenter = (CenterX | Top), TopRight = (Top | Right),
+ CenterLeft = (Left | CenterY), Center = (CenterX | CenterY), CenterRight = (Right | CenterY),
+ BottomLeft = (Bottom | Left), BottomCenter = (CenterX | Bottom), BottomRight = (Bottom | Right),
}
public enum GUISoundType
@@ -136,15 +135,15 @@ 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, "");
int y = 0;
- var button = new GUIButton(new Rectangle(0, y, 0, 30), "Resume", Alignment.CenterX, Style, pauseMenu);
+ var button = new GUIButton(new Rectangle(0, y, 0, 30), "Resume", Alignment.CenterX, "", pauseMenu);
button.OnClicked = TogglePauseMenu;
y += 60;
- button = new GUIButton(new Rectangle(0, y, 0, 30), "Settings", Alignment.CenterX, Style, pauseMenu);
+ button = new GUIButton(new Rectangle(0, y, 0, 30), "Settings", Alignment.CenterX, "", pauseMenu);
button.OnClicked = (btn, userData) =>
{
TogglePauseMenu();
@@ -161,7 +160,7 @@ namespace Barotrauma
SinglePlayerMode spMode = GameMain.GameSession.gameMode as SinglePlayerMode;
if (spMode != null)
{
- button = new GUIButton(new Rectangle(0, y, 0, 30), "Load previous", Alignment.CenterX, Style, pauseMenu);
+ button = new GUIButton(new Rectangle(0, y, 0, 30), "Load previous", Alignment.CenterX, "", pauseMenu);
button.OnClicked += TogglePauseMenu;
button.OnClicked += GameMain.GameSession.LoadPrevious;
@@ -174,7 +173,7 @@ namespace Barotrauma
SinglePlayerMode spMode = GameMain.GameSession.gameMode as SinglePlayerMode;
if (spMode != null)
{
- button = new GUIButton(new Rectangle(0, y, 0, 30), "Save & quit", Alignment.CenterX, Style, pauseMenu);
+ button = new GUIButton(new Rectangle(0, y, 0, 30), "Save & quit", Alignment.CenterX, "", pauseMenu);
button.OnClicked += QuitClicked;
button.OnClicked += TogglePauseMenu;
button.UserData = "save";
@@ -184,7 +183,7 @@ namespace Barotrauma
}
- button = new GUIButton(new Rectangle(0, y, 0, 30), "Quit", Alignment.CenterX, Style, pauseMenu);
+ button = new GUIButton(new Rectangle(0, y, 0, 30), "Quit", Alignment.CenterX, "", pauseMenu);
button.OnClicked += QuitClicked;
button.OnClicked += TogglePauseMenu;
}
@@ -435,24 +434,24 @@ namespace Barotrauma
"FPS: " + (int)GameMain.FrameCounter.AverageFramesPerSecond,
Color.White, Color.Black * 0.5f, 0, SmallFont);
- DrawString(spriteBatch, new Vector2(10, 20),
+ DrawString(spriteBatch, new Vector2(10, 25),
"Physics: " + GameMain.World.UpdateTime,
Color.White, Color.Black * 0.5f, 0, SmallFont);
- DrawString(spriteBatch, new Vector2(10, 30),
+ DrawString(spriteBatch, new Vector2(10, 40),
"Bodies: " + GameMain.World.BodyList.Count + " (" + GameMain.World.BodyList.FindAll(b => b.Awake && b.Enabled).Count + " awake)",
Color.White, Color.Black * 0.5f, 0, SmallFont);
if (Screen.Selected.Cam != null)
{
- DrawString(spriteBatch, new Vector2(10, 40),
+ DrawString(spriteBatch, new Vector2(10, 55),
"Camera pos: " + Screen.Selected.Cam.Position.ToPoint(),
Color.White, Color.Black * 0.5f, 0, SmallFont);
}
if (Submarine.MainSub != null)
{
- DrawString(spriteBatch, new Vector2(10, 50),
+ DrawString(spriteBatch, new Vector2(10, 70),
"Sub pos: " + Submarine.MainSub.Position.ToPoint(),
Color.White, Color.Black * 0.5f, 0, SmallFont);
}
diff --git a/Subsurface/Source/GUI/GUIButton.cs b/Subsurface/Source/GUI/GUIButton.cs
index 7955d5def..bbbee7b4a 100644
--- a/Subsurface/Source/GUI/GUIButton.cs
+++ b/Subsurface/Source/GUI/GUIButton.cs
@@ -133,63 +133,60 @@ namespace Barotrauma
public bool Selected { get; set; }
- public GUIButton(Rectangle rect, string text, GUIStyle style, GUIComponent parent = null)
+ public GUIButton(Rectangle rect, string text, string style, GUIComponent parent = null)
: this(rect, text, null, Alignment.Left, style, parent)
{
}
- public GUIButton(Rectangle rect, string text, Alignment alignment, GUIStyle style, GUIComponent parent = null)
+ public GUIButton(Rectangle rect, string text, Alignment alignment, string style, GUIComponent parent = null)
: this(rect, text, null, alignment, style, parent)
{
}
- public GUIButton(Rectangle rect, string text, Color? color, GUIStyle style, GUIComponent parent = null)
+ public GUIButton(Rectangle rect, string text, Color? color, string style, GUIComponent parent = null)
: this(rect, text, color, (Alignment.Left | Alignment.Top), style, parent)
{
}
- public GUIButton(Rectangle rect, string text, Color? color, Alignment alignment, GUIStyle style, GUIComponent parent = null)
- :this(rect, text, color, alignment, Alignment.Center, style, parent)
+ public GUIButton(Rectangle rect, string text, Color? color, Alignment alignment, string style = "", GUIComponent parent = null)
+ : this(rect, text, color, alignment, Alignment.Center, style, parent)
{
}
- public GUIButton(Rectangle rect, string text, Color? color, Alignment alignment, Alignment textAlignment, GUIStyle style, GUIComponent parent = null)
- :base (style)
+ public GUIButton(Rectangle rect, string text, Color? color, Alignment alignment, Alignment textAlignment, string style = "", GUIComponent parent = null)
+ : base(style)
{
this.rect = rect;
- if (color!=null) this.color = (Color)color;
+ if (color != null) this.color = (Color)color;
this.alignment = alignment;
if (parent != null) parent.AddChild(this);
frame = new GUIFrame(Rectangle.Empty, style, this);
- if (style != null) style.Apply(frame, this);
+ GUI.Style.Apply(frame, style == "" ? "GUIButton" : style);
textBlock = new GUITextBlock(Rectangle.Empty, text,
Color.Transparent, (this.style == null) ? Color.Black : this.style.textColor,
- textAlignment, style, this);
+ textAlignment, null, this);
+ GUI.Style.Apply(textBlock, style, this);
Enabled = true;
}
-
+
+ public override void ApplyStyle(GUIComponentStyle style)
+ {
+ base.ApplyStyle(style);
+
+ if (frame != null) frame.ApplyStyle(style);
+ if (textBlock != null) textBlock.ApplyStyle(style);
+ }
+
public override void Draw(SpriteBatch spriteBatch)
{
if (!Visible) return;
- //Color currColor = color;
- //if (state == ComponentState.Hover) currColor = hoverColor;
- //if (state == ComponentState.Selected) currColor = selectedColor;
-
- //GUI.DrawRectangle(spriteBatch, rect, currColor * alpha, true);
-
- ////spriteBatch.DrawString(HUD.font, text, new Vector2(rect.X+rect.Width/2, rect.Y+rect.Height/2), Color.Black, 0.0f, new Vector2(0.5f,0.5f), 1.0f, SpriteEffects.None, 0.0f);
-
- //GUI.DrawRectangle(spriteBatch, rect, Color.Black * alpha, false);
-
DrawChildren(spriteBatch);
-
- //if (!Enabled) GUI.DrawRectangle(spriteBatch, rect, Color.Gray*0.5f, true);
}
public override void Update(float deltaTime)
@@ -203,7 +200,7 @@ namespace Barotrauma
{
if (OnPressed != null)
{
- if (OnPressed()) state = ComponentState.Selected;
+ if (OnPressed()) state = ComponentState.Pressed;
}
}
else if (PlayerInput.LeftButtonClicked())
diff --git a/Subsurface/Source/GUI/GUIComponent.cs b/Subsurface/Source/GUI/GUIComponent.cs
index 94e4b3d54..d91b81cf6 100644
--- a/Subsurface/Source/GUI/GUIComponent.cs
+++ b/Subsurface/Source/GUI/GUIComponent.cs
@@ -73,7 +73,7 @@ namespace Barotrauma
protected static KeyboardDispatcher keyboardDispatcher;
- public enum ComponentState { None, Hover, Selected};
+ public enum ComponentState { None, Hover, Pressed, Selected };
protected Alignment alignment;
@@ -111,6 +111,11 @@ namespace Barotrauma
set;
}
+ public GUIComponentStyle Style
+ {
+ get { return style; }
+ }
+
public bool Visible
{
get;
@@ -119,7 +124,7 @@ namespace Barotrauma
public bool TileSprites;
- private GUITextBlock toolTipBlock;
+ private static GUITextBlock toolTipBlock;
//protected float alpha;
@@ -161,7 +166,7 @@ namespace Barotrauma
get { return CanBeFocused ? rect : Rectangle.Empty; }
}
- public List sprites;
+ public Dictionary> sprites;
//public Alignment SpriteAlignment { get; set; }
//public bool RepeatSpriteX, RepeatSpriteY;
@@ -213,7 +218,7 @@ namespace Barotrauma
get { return keyboardDispatcher; }
}
- protected GUIComponent(GUIStyle style)
+ protected GUIComponent(string style)
{
Visible = true;
@@ -222,13 +227,13 @@ namespace Barotrauma
OutlineColor = Color.Transparent;
Font = GUI.Font;
-
- sprites = new List();
+
children = new List();
CanBeFocused = true;
- if (style!=null) style.Apply(this);
+ if (style != null)
+ GUI.Style.Apply(this, style);
}
public static void Init(GameWindow window)
@@ -285,20 +290,45 @@ namespace Barotrauma
if (state == ComponentState.Selected) currColor = selectedColor;
if (state == ComponentState.Hover) currColor = hoverColor;
- if (flashTimer>0.0f)
+ if (flashTimer > 0.0f)
{
- GUI.DrawRectangle(spriteBatch,
- new Rectangle(rect.X-5,rect.Y-5,rect.Width+10,rect.Height+10),
+ GUI.DrawRectangle(spriteBatch,
+ new Rectangle(rect.X - 5, rect.Y - 5, rect.Width + 10, rect.Height + 10),
flashColor * (flashTimer / FlashDuration), true);
}
- if (currColor.A>0.0f && !sprites.Any()) GUI.DrawRectangle(spriteBatch, rect, currColor * (currColor.A / 255.0f), true);
+ if (currColor.A > 0.0f && (sprites == null || !sprites.Any())) GUI.DrawRectangle(spriteBatch, rect, currColor * (currColor.A / 255.0f), true);
- if (sprites != null)
+ if (sprites != null && sprites[state] != null && currColor.A > 0.0f)
{
- foreach (UISprite uiSprite in sprites)
+ foreach (UISprite uiSprite in sprites[state])
{
- if (uiSprite.Tile)
+ if (uiSprite.Slice)
+ {
+ Vector2 pos = new Vector2(rect.X, rect.Y);
+
+ int centerWidth = Math.Max(rect.Width - uiSprite.Slices[0].Width - uiSprite.Slices[2].Width, 0);
+ int centerHeight = Math.Max(rect.Height - uiSprite.Slices[0].Height - uiSprite.Slices[8].Height, 0);
+
+ for (int x = 0; x < 3; x++)
+ {
+ int width = x == 1 ? centerWidth : uiSprite.Slices[x].Width;
+ for (int y = 0; y < 3; y++)
+ {
+ int height = y == 1 ? centerHeight : uiSprite.Slices[x + y * 3].Height;
+
+ spriteBatch.Draw(uiSprite.Sprite.Texture,
+ new Rectangle((int)pos.X, (int)pos.Y, width, height),
+ uiSprite.Slices[x + y * 3],
+ currColor * (currColor.A / 255.0f));
+
+ pos.Y += height;
+ }
+ pos.X += width;
+ pos.Y = rect.Y;
+ }
+ }
+ else if (uiSprite.Tile)
{
Vector2 startPos = new Vector2(rect.X, rect.Y);
Vector2 size = new Vector2(Math.Min(uiSprite.Sprite.SourceRect.Width, rect.Width), Math.Min(uiSprite.Sprite.SourceRect.Height, rect.Height));
@@ -336,18 +366,17 @@ namespace Barotrauma
//DrawChildren(spriteBatch);
}
- public void DrawToolTip(SpriteBatch spriteBatch)
+ public void DrawToolTip(SpriteBatch spriteBatch)
{
if (!Visible) return;
int width = 400;
- if (toolTipBlock==null || (string)toolTipBlock.userData != ToolTip)
+ if (toolTipBlock == null || (string)toolTipBlock.userData != ToolTip)
{
- toolTipBlock = new GUITextBlock(new Rectangle(0,0,width, 18), ToolTip, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, null, true, GUI.SmallFont);
+ toolTipBlock = new GUITextBlock(new Rectangle(0, 0, width, 18), ToolTip, "GUIToolTip", Alignment.TopLeft, Alignment.TopLeft, null, true, GUI.SmallFont);
toolTipBlock.padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
toolTipBlock.rect.Width = (int)(GUI.SmallFont.MeasureString(toolTipBlock.WrappedText).X + 20);
- toolTipBlock.rect.Height = toolTipBlock.WrappedText.Split('\n').Length * 18;
- toolTipBlock.Color = Color.Black * 0.7f;
+ toolTipBlock.rect.Height = toolTipBlock.WrappedText.Split('\n').Length * 18 + 7;
toolTipBlock.userData = ToolTip;
}
@@ -438,13 +467,15 @@ namespace Barotrauma
}
public virtual void ApplyStyle(GUIComponentStyle style)
- {
+ {
+ if (style == null) return;
+
color = style.Color;
hoverColor = style.HoverColor;
selectedColor = style.SelectedColor;
padding = style.Padding;
- sprites = new List(style.Sprites);
+ sprites = style.Sprites;
OutlineColor = style.OutlineColor;
diff --git a/Subsurface/Source/GUI/GUIDropDown.cs b/Subsurface/Source/GUI/GUIDropDown.cs
index 177616007..2a1b8802f 100644
--- a/Subsurface/Source/GUI/GUIDropDown.cs
+++ b/Subsurface/Source/GUI/GUIDropDown.cs
@@ -74,24 +74,20 @@ namespace Barotrauma
}
}
- public GUIDropDown(Rectangle rect, string text, GUIStyle style, GUIComponent parent = null)
+ public GUIDropDown(Rectangle rect, string text, string style, GUIComponent parent = null)
: base(style)
{
this.rect = rect;
if (parent != null) parent.AddChild(this);
- button = new GUIButton(this.rect, text, Color.White, Alignment.TopLeft, Alignment.TopLeft, null, null);
-
- button.TextColor = Color.White;
- button.Color = Color.Black * 0.8f;
- button.HoverColor = Color.DarkGray * 0.8f;
- button.OutlineColor = Color.LightGray * 0.8f;
+ button = new GUIButton(this.rect, text, Color.White, Alignment.TopLeft, Alignment.CenterLeft, "GUIDropDown", null);
+ GUI.Style.Apply(button, style, this);
+
button.OnClicked = OnClicked;
listBox = new GUIListBox(new Rectangle(this.rect.X, this.rect.Bottom, this.rect.Width, 200), style, null);
listBox.OnSelected = SelectItem;
- //listBox.ScrollBarEnabled = false;
}
public override void AddChild(GUIComponent child)
@@ -101,7 +97,7 @@ namespace Barotrauma
public void AddItem(string text, object userData = null)
{
- GUITextBlock textBlock = new GUITextBlock(new Rectangle(0,0,0,20), text, GUI.Style, listBox);
+ GUITextBlock textBlock = new GUITextBlock(new Rectangle(0,0,0,20), text, "ListBoxElement", Alignment.TopLeft, Alignment.CenterLeft, listBox);
textBlock.UserData = userData;
}
diff --git a/Subsurface/Source/GUI/GUIFrame.cs b/Subsurface/Source/GUI/GUIFrame.cs
index bf15905f6..d75a732fc 100644
--- a/Subsurface/Source/GUI/GUIFrame.cs
+++ b/Subsurface/Source/GUI/GUIFrame.cs
@@ -5,18 +5,18 @@ namespace Barotrauma
{
public class GUIFrame : GUIComponent
{
- public GUIFrame(Rectangle rect, GUIStyle style = null, GUIComponent parent = null)
+ public GUIFrame(Rectangle rect, string style = "", GUIComponent parent = null)
: this(rect, null, (Alignment.Left | Alignment.Top), style, parent)
{
}
- public GUIFrame(Rectangle rect, Color color, GUIStyle style = null, GUIComponent parent = null)
+ public GUIFrame(Rectangle rect, Color color, string style = "", GUIComponent parent = null)
: this(rect, color, (Alignment.Left | Alignment.Top), style, parent)
{
}
- public GUIFrame(Rectangle rect, Color? color, Alignment alignment, GUIStyle style = null, GUIComponent parent = null)
+ public GUIFrame(Rectangle rect, Color? color, Alignment alignment, string style = "", GUIComponent parent = null)
: base(style)
{
this.rect = rect;
@@ -45,7 +45,7 @@ namespace Barotrauma
if (state == ComponentState.Selected) currColor = selectedColor;
if (state == ComponentState.Hover) currColor = hoverColor;
- if (!sprites.Any()) GUI.DrawRectangle(spriteBatch, rect, currColor * (currColor.A/255.0f), true);
+ if (sprites == null || !sprites.Any()) GUI.DrawRectangle(spriteBatch, rect, currColor * (currColor.A/255.0f), true);
base.Draw(spriteBatch);
if (OutlineColor != Color.Transparent)
diff --git a/Subsurface/Source/GUI/GUIListBox.cs b/Subsurface/Source/GUI/GUIListBox.cs
index e57051e4c..81fc0f2b2 100644
--- a/Subsurface/Source/GUI/GUIListBox.cs
+++ b/Subsurface/Source/GUI/GUIListBox.cs
@@ -107,22 +107,22 @@ namespace Barotrauma
}
}
- public GUIListBox(Rectangle rect, GUIStyle style, GUIComponent parent = null)
+ public GUIListBox(Rectangle rect, string style, GUIComponent parent = null)
: this(rect, style, Alignment.TopLeft, parent)
{
}
- public GUIListBox(Rectangle rect, GUIStyle style, Alignment alignment, GUIComponent parent = null)
+ public GUIListBox(Rectangle rect, string style, Alignment alignment, GUIComponent parent = null)
: this(rect, null, alignment, style, parent, false)
{
}
- public GUIListBox(Rectangle rect, Color? color, GUIStyle style = null, GUIComponent parent = null)
+ public GUIListBox(Rectangle rect, Color? color, string style = null, GUIComponent parent = null)
: this(rect, color, (Alignment.Left | Alignment.Top), style, parent)
{
}
- public GUIListBox(Rectangle rect, Color? color, Alignment alignment, GUIStyle style = null, GUIComponent parent = null, bool isHorizontal = false)
+ public GUIListBox(Rectangle rect, Color? color, Alignment alignment, string style = null, GUIComponent parent = null, bool isHorizontal = false)
: base(style)
{
this.rect = rect;
@@ -140,18 +140,18 @@ namespace Barotrauma
if (isHorizontal)
{
scrollBar = new GUIScrollBar(
- new Rectangle(this.rect.X, this.rect.Bottom - 20, this.rect.Width, 20), null, 1.0f, GUI.Style);
+ new Rectangle(this.rect.X, this.rect.Bottom - 20, this.rect.Width, 20), null, 1.0f, "");
}
else
{
scrollBar = new GUIScrollBar(
- new Rectangle(this.rect.Right - 20, this.rect.Y, 20, this.rect.Height), null, 1.0f, GUI.Style);
+ new Rectangle(this.rect.Right - 20, this.rect.Y, 20, this.rect.Height), null, 1.0f, "");
}
scrollBar.IsHorizontal = isHorizontal;
- frame = new GUIFrame(Rectangle.Empty, style, this);
- if (style != null) style.Apply(frame, this);
+ frame = new GUIFrame(new Rectangle(0, 0, this.rect.Width, this.rect.Height), style, this);
+ if (style != null) GUI.Style.Apply(frame, style, this);
UpdateScrollBarSize();
diff --git a/Subsurface/Source/GUI/GUIMessageBox.cs b/Subsurface/Source/GUI/GUIMessageBox.cs
index cafbb0be3..9e0755058 100644
--- a/Subsurface/Source/GUI/GUIMessageBox.cs
+++ b/Subsurface/Source/GUI/GUIMessageBox.cs
@@ -26,21 +26,21 @@ namespace Barotrauma
set { (children[0].children[1] as GUITextBlock).Text = value; }
}
- public GUIMessageBox(string header, string text)
- : this(header, text, new string[] {"OK"})
+ public GUIMessageBox(string headerText, string text)
+ : this(headerText, text, new string[] {"OK"})
{
this.Buttons[0].OnClicked = Close;
}
- public GUIMessageBox(string header, string text, int width, int height)
- : this(header, text, new string[] { "OK" }, width, height)
+ public GUIMessageBox(string headerText, string text, int width, int height)
+ : this(headerText, text, new string[] { "OK" }, width, height)
{
this.Buttons[0].OnClicked = Close;
}
-
- public GUIMessageBox(string header, string text, string[] buttons, int width=DefaultWidth, int height=DefaultHeight, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null)
- : base(new Rectangle(0,0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
- Color.Black*0.5f, Alignment.TopLeft, null, parent)
+
+ public GUIMessageBox(string headerText, string text, string[] buttons, int width = DefaultWidth, int height = DefaultHeight, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null)
+ : base(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
+ Color.Black * 0.5f, Alignment.TopLeft, null, parent)
{
if (height == 0)
{
@@ -53,20 +53,24 @@ namespace Barotrauma
height += 220;
}
- var frame = new GUIFrame(new Rectangle(0,0,width,height), null, Alignment.Center, GUI.Style, this);
+ var frame = new GUIFrame(new Rectangle(0, 0, width, height), null, Alignment.Center, "", this);
+ GUI.Style.Apply(frame, "", this);
+
+ var header = new GUITextBlock(new Rectangle(0, 0, 0, 30), headerText, null, null, textAlignment, "", frame, true);
+ GUI.Style.Apply(header, "", this);
- new GUITextBlock(new Rectangle(0, 0, 0, 30), header, Color.Transparent, Color.White, textAlignment, GUI.Style, frame, true);
if (!string.IsNullOrWhiteSpace(text))
{
- new GUITextBlock(new Rectangle(0, 30, 0, height - 70), text,
- Color.Transparent, Color.White, textAlignment, GUI.Style, frame, true);
+ var textBlock = new GUITextBlock(new Rectangle(0, 30, 0, height - 70), text,
+ null, null, textAlignment, "", frame, true);
+ GUI.Style.Apply(textBlock, "", this);
}
int x = 0;
this.Buttons = new GUIButton[buttons.Length];
for (int i = 0; i < buttons.Length; i++)
{
- this.Buttons[i] = new GUIButton(new Rectangle(x, 0, 150, 30), buttons[i], Alignment.Left | Alignment.Bottom, GUI.Style, frame);
+ this.Buttons[i] = new GUIButton(new Rectangle(x, 0, 150, 30), buttons[i], Alignment.Left | Alignment.Bottom, "", frame);
x += this.Buttons[i].Rect.Width + 20;
}
diff --git a/Subsurface/Source/GUI/GUIProgressBar.cs b/Subsurface/Source/GUI/GUIProgressBar.cs
index 858cf30bf..b3277d047 100644
--- a/Subsurface/Source/GUI/GUIProgressBar.cs
+++ b/Subsurface/Source/GUI/GUIProgressBar.cs
@@ -7,11 +7,9 @@ namespace Barotrauma
{
private bool isHorizontal;
- private GUIFrame frame;
+ private GUIFrame frame, slider;
private float barSize;
-
- private int margin;
-
+
public delegate float ProgressGetterHandler();
public ProgressGetterHandler ProgressGetter;
@@ -24,26 +22,26 @@ namespace Barotrauma
public float BarSize
{
get { return barSize; }
- set
+ set
{
float oldBarSize = barSize;
barSize = MathHelper.Clamp(value, 0.0f, 1.0f);
- if (barSize!=oldBarSize) UpdateRect();
+ if (barSize != oldBarSize) UpdateRect();
}
}
public GUIProgressBar(Rectangle rect, Color color, float barSize, GUIComponent parent = null)
- : this(rect,color,barSize, (Alignment.Left | Alignment.Top), parent)
+ : this(rect, color, barSize, (Alignment.Left | Alignment.Top), parent)
{
}
public GUIProgressBar(Rectangle rect, Color color, float barSize, Alignment alignment, GUIComponent parent = null)
- : this(rect,color,null, barSize,alignment, parent)
+ : this(rect, color, null, barSize, alignment, parent)
{
-
+
}
- public GUIProgressBar(Rectangle rect, Color color, GUIStyle style, float barSize, Alignment alignment, GUIComponent parent = null)
+ public GUIProgressBar(Rectangle rect, Color color, string style, float barSize, Alignment alignment, GUIComponent parent = null)
: base(style)
{
this.rect = rect;
@@ -51,21 +49,21 @@ namespace Barotrauma
isHorizontal = (rect.Width > rect.Height);
this.alignment = alignment;
-
- margin = 5;
-
+
if (parent != null)
parent.AddChild(this);
- frame = new GUIFrame(new Rectangle(0, 0, 0, 0), Color.Black, null, this);
+ 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);
+ GUI.Style.Apply(slider, "Slider", this);
this.barSize = barSize;
UpdateRect();
-
- if (style != null) style.Apply(this);
}
- public override void ApplyStyle(GUIComponentStyle style)
+ /*public override void ApplyStyle(GUIComponentStyle style)
{
if (frame == null) return;
@@ -78,15 +76,15 @@ namespace Barotrauma
frame.OutlineColor = style.OutlineColor;
this.style = style;
- }
+ }*/
private void UpdateRect()
{
- rect = new Rectangle(
+ slider.Rect = new Rectangle(
(int)(frame.Rect.X + padding.X),
(int)(frame.Rect.Y + padding.Y),
- isHorizontal ? (int)((frame.Rect.Width - padding.X - padding.Z) * barSize) : (frame.Rect.Width - margin * 2),
- isHorizontal ? (int)(frame.Rect.Height - padding.Y - padding.W) : (int)((frame.Rect.Height - margin * 2) * barSize));
+ isHorizontal ? (int)((frame.Rect.Width - padding.X - padding.Z) * barSize) : frame.Rect.Width,
+ isHorizontal ? (int)(frame.Rect.Height - padding.Y - padding.W) : (int)(frame.Rect.Height * barSize));
}
public override void Draw(SpriteBatch spriteBatch)
@@ -97,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/GUI/GUIScrollBar.cs b/Subsurface/Source/GUI/GUIScrollBar.cs
index 4e21592df..414f75059 100644
--- a/Subsurface/Source/GUI/GUIScrollBar.cs
+++ b/Subsurface/Source/GUI/GUIScrollBar.cs
@@ -45,20 +45,21 @@ namespace Barotrauma
set
{
barScroll = MathHelper.Clamp(value, 0.0f, 1.0f);
- int newX = bar.Rect.X - frame.Rect.X, newY = bar.Rect.Y - frame.Rect.Y;
+ int newX = bar.Rect.X - frame.Rect.X;
+ int newY = bar.Rect.Y - frame.Rect.Y;
float newScroll = step == 0.0f ? barScroll : MathUtils.RoundTowardsClosest(barScroll, step);
if (isHorizontal)
{
- newX = (int)(newScroll * (frame.Rect.Width - bar.Rect.Width));
- newX = MathHelper.Clamp(newX, 0, frame.Rect.Width - bar.Rect.Width);
+ newX = (int)(frame.Padding.X + newScroll * (frame.Rect.Width - bar.Rect.Width - frame.Padding.X - frame.Padding.Z));
+ newX = MathHelper.Clamp(newX, (int)frame.Padding.X, frame.Rect.Width - bar.Rect.Width - (int)frame.Padding.Z);
}
else
{
- newY = (int)(newScroll * (frame.Rect.Height - bar.Rect.Height));
- newY = MathHelper.Clamp(newY, 0, frame.Rect.Height - bar.Rect.Height);
+ newY = (int)(frame.Padding.Y + newScroll * (frame.Rect.Height - bar.Rect.Height - frame.Padding.Y - frame.Padding.W));
+ newY = MathHelper.Clamp(newY, (int)frame.Padding.Y, frame.Rect.Height - bar.Rect.Height - (int)frame.Padding.W);
}
bar.Rect = new Rectangle(newX + frame.Rect.X, newY + frame.Rect.Y, bar.Rect.Width, bar.Rect.Height);
@@ -88,18 +89,18 @@ namespace Barotrauma
}
}
- public GUIScrollBar(Rectangle rect, GUIStyle style, float barSize, GUIComponent parent = null)
+ public GUIScrollBar(Rectangle rect, string style, float barSize, GUIComponent parent = null)
: this(rect, null, barSize, style, parent)
{
}
- public GUIScrollBar(Rectangle rect, Color? color, float barSize, GUIStyle style = null, GUIComponent parent = null)
+ public GUIScrollBar(Rectangle rect, Color? color, float barSize, string style = "", GUIComponent parent = null)
: this(rect, color, barSize, Alignment.TopLeft, style, parent)
{
}
- public GUIScrollBar(Rectangle rect, Color? color, float barSize, Alignment alignment, GUIStyle style = null, GUIComponent parent = null)
+ public GUIScrollBar(Rectangle rect, Color? color, float barSize, Alignment alignment, string style = "", GUIComponent parent = null)
: base(style)
{
this.rect = rect;
@@ -111,17 +112,15 @@ namespace Barotrauma
parent.AddChild(this);
isHorizontal = (rect.Width > rect.Height);
- frame = new GUIFrame(new Rectangle(0,0,0,0), Color.Black*0.8f, style, this);
- //AddChild(frame);
-
- //System.Diagnostics.Debug.WriteLine(frame.rect);
+ frame = new GUIFrame(new Rectangle(0,0,0,0), style, this);
+ GUI.Style.Apply(frame, isHorizontal ? "GUIFrameHorizontal" : "GUIFrameVertical", this);
this.barSize = barSize;
- bar = new GUIButton(new Rectangle(0, 0, 0, 0), "", color, style, this);
+ bar = new GUIButton(new Rectangle(0, 0, 0, 0), "", color, "", this);
+ GUI.Style.Apply(bar, isHorizontal ? "GUIButtonHorizontal" : "GUIButtoneVertical", this);
bar.OnPressed = SelectBar;
- //AddChild(bar);
enabled = true;
@@ -130,12 +129,16 @@ namespace Barotrauma
private void UpdateRect()
{
-
+ float width = frame.Rect.Width - frame.Padding.X - frame.Padding.Z;
+ float height = frame.Rect.Height - frame.Padding.Y - frame.Padding.W;
+
bar.Rect = new Rectangle(
bar.Rect.X,
bar.Rect.Y,
- isHorizontal ? (int)(frame.Rect.Width * barSize) : frame.Rect.Width,
- isHorizontal ? frame.Rect.Height : (int)(frame.Rect.Height * barSize));
+ isHorizontal ? (int)(width * barSize) : (int)width,
+ isHorizontal ? (int)height : (int)(height * barSize));
+
+ ClampRect();
foreach (GUIComponent child in bar.children)
{
@@ -143,16 +146,36 @@ namespace Barotrauma
}
}
+ private void ClampRect()
+ {
+ bar.Rect = new Rectangle(
+ (int)MathHelper.Clamp(bar.Rect.X, frame.Rect.X + frame.Padding.X, frame.Rect.Right - bar.Rect.Width - frame.Padding.X - frame.Padding.Z),
+ (int)MathHelper.Clamp(bar.Rect.Y, frame.Rect.Y + frame.Padding.Y, frame.Rect.Bottom - bar.Rect.Height - frame.Padding.Y - frame.Padding.W),
+ bar.Rect.Width,
+ bar.Rect.Height);
+ }
+
public override void Update(float deltaTime)
{
if (!Visible) return;
base.Update(deltaTime);
- if (draggingBar != this) return;
- if (!PlayerInput.LeftButtonHeld()) draggingBar = null;
+ if (MouseOn == frame)
+ {
+ if (PlayerInput.LeftButtonClicked())
+ {
+ MoveButton(new Vector2(
+ Math.Sign(PlayerInput.MousePosition.X - bar.Rect.Center.X) * bar.Rect.Width,
+ Math.Sign(PlayerInput.MousePosition.Y - bar.Rect.Center.Y) * bar.Rect.Height));
+ }
+ }
- MoveButton();
+ if (draggingBar == this)
+ {
+ if (!PlayerInput.LeftButtonHeld()) draggingBar = null;
+ MoveButton(PlayerInput.MouseSpeed);
+ }
}
public override void Draw(SpriteBatch spriteBatch)
@@ -173,27 +196,22 @@ namespace Barotrauma
}
- private void MoveButton()
+ private void MoveButton(Vector2 moveAmount)
{
- float moveAmount;
if (isHorizontal)
{
- moveAmount = PlayerInput.MouseSpeed.X;
- barScroll += moveAmount / (frame.Rect.Width - bar.Rect.Width);
+ moveAmount.Y = 0.0f;
+ barScroll += moveAmount.X / (frame.Rect.Width - bar.Rect.Width - frame.Padding.X - frame.Padding.Z);
}
else
{
- moveAmount = PlayerInput.MouseSpeed.Y;
- barScroll += moveAmount / (frame.Rect.Height - bar.Rect.Height);
+ moveAmount.X = 0.0f;
+ barScroll += moveAmount.Y / (frame.Rect.Height - bar.Rect.Height - frame.Padding.Y - frame.Padding.W);
}
BarScroll = barScroll;
- if (moveAmount != 0 && OnMoved != null) OnMoved(this, BarScroll);
-
-
- //bar.Rect = new Rectangle(newX + frame.Rect.X, newY + frame.Rect.Y, bar.Rect.Width, bar.Rect.Height);
-
+ if (moveAmount != Vector2.Zero && OnMoved != null) OnMoved(this, BarScroll);
}
}
diff --git a/Subsurface/Source/GUI/GUIStyle.cs b/Subsurface/Source/GUI/GUIStyle.cs
index 5fdc59c7d..4e7ffc972 100644
--- a/Subsurface/Source/GUI/GUIStyle.cs
+++ b/Subsurface/Source/GUI/GUIStyle.cs
@@ -10,7 +10,6 @@ namespace Barotrauma
public GUIStyle(string file)
{
-
componentStyles = new Dictionary();
XDocument doc;
@@ -32,21 +31,43 @@ namespace Barotrauma
}
}
- public void Apply(GUIComponent targetComponent, GUIComponent parent = null)
+ public void Apply(GUIComponent targetComponent, string styleName = "", GUIComponent parent = null)
{
- GUIComponentStyle componentStyle = null;
- string name = (parent == null) ? targetComponent.GetType().Name.ToLowerInvariant() : parent.GetType().Name.ToLowerInvariant();
- componentStyles.TryGetValue(name, out componentStyle);
-
- if (componentStyle==null)
+ GUIComponentStyle componentStyle = null;
+ if (parent != null)
{
- DebugConsole.ThrowError("Couldn't find a GUI style for "+targetComponent.GetType().Name);
- return;
- }
+ GUIComponentStyle parentStyle = parent.Style;
+
+ if (parent.Style == null)
+ {
+ string parentStyleName = parent.GetType().Name.ToLowerInvariant();
+
+ if (!componentStyles.TryGetValue(parentStyleName, out parentStyle))
+ {
+ DebugConsole.ThrowError("Couldn't find a GUI style \""+ parentStyleName + "\"");
+ return;
+ }
+ }
+
+
+ string childStyleName = string.IsNullOrEmpty(styleName) ? targetComponent.GetType().Name : styleName;
+ parentStyle.ChildStyles.TryGetValue(childStyleName.ToLowerInvariant(), out componentStyle);
+ }
+ else
+ {
+ if (string.IsNullOrEmpty(styleName))
+ {
+ styleName = targetComponent.GetType().Name;
+ }
+ if (!componentStyles.TryGetValue(styleName.ToLowerInvariant(), out componentStyle))
+ {
+ DebugConsole.ThrowError("Couldn't find a GUI style \""+ styleName+"\"");
+ return;
+ }
+ }
+
targetComponent.ApplyStyle(componentStyle);
}
-
-
}
}
diff --git a/Subsurface/Source/GUI/GUITextBlock.cs b/Subsurface/Source/GUI/GUITextBlock.cs
index 5bcd2a9cb..091cd0617 100644
--- a/Subsurface/Source/GUI/GUITextBlock.cs
+++ b/Subsurface/Source/GUI/GUITextBlock.cs
@@ -125,18 +125,18 @@ namespace Barotrauma
get { return caretPos; }
}
- public GUITextBlock(Rectangle rect, string text, GUIStyle style, GUIComponent parent, ScalableFont font)
+ public GUITextBlock(Rectangle rect, string text, string style, GUIComponent parent, ScalableFont font)
: this(rect, text, style, Alignment.TopLeft, Alignment.TopLeft, parent, false, font)
{
}
- public GUITextBlock(Rectangle rect, string text, GUIStyle style, GUIComponent parent = null, bool wrap = false)
+ public GUITextBlock(Rectangle rect, string text, string style, GUIComponent parent = null, bool wrap = false)
: this(rect, text, style, Alignment.TopLeft, Alignment.TopLeft, parent, wrap)
{
}
- public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment textAlignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null, bool wrap = false)
+ public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment textAlignment = Alignment.Left, string style = null, GUIComponent parent = null, bool wrap = false)
: this(rect, text,color, textColor, Alignment.TopLeft, textAlignment, style, parent, wrap)
{
}
@@ -150,21 +150,22 @@ namespace Barotrauma
public override void ApplyStyle(GUIComponentStyle style)
{
+ if (style == null) return;
base.ApplyStyle(style);
textColor = style.textColor;
}
- public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment alignment, Alignment textAlignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null, bool wrap = false)
+ public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment alignment, Alignment textAlignment = Alignment.Left, string style = null, GUIComponent parent = null, bool wrap = false)
: this (rect, text, style, alignment, textAlignment, parent, wrap, null)
{
if (color != null) this.color = (Color)color;
if (textColor != null) this.textColor = (Color)textColor;
}
- public GUITextBlock(Rectangle rect, string text, GUIStyle style, Alignment alignment = Alignment.TopLeft, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null, bool wrap = false, ScalableFont font = null)
- :base (style)
+ public GUITextBlock(Rectangle rect, string text, string style, Alignment alignment = Alignment.TopLeft, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null, bool wrap = false, ScalableFont font = null)
+ : base(style)
{
this.Font = font == null ? GUI.Font : font;
@@ -174,6 +175,8 @@ namespace Barotrauma
this.alignment = alignment;
+ this.padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
+
this.textAlignment = textAlignment;
if (parent != null)
@@ -278,7 +281,7 @@ namespace Barotrauma
Rectangle drawRect = rect;
if (offset != Vector2.Zero) drawRect.Location += offset.ToPoint();
- if (currColor.A * currColor.A > 0.0f) GUI.DrawRectangle(spriteBatch, rect, currColor * (currColor.A / 255.0f), true);
+ //if (currColor.A * currColor.A > 0.0f) GUI.DrawRectangle(spriteBatch, rect, currColor * (currColor.A / 255.0f), true);
base.Draw(spriteBatch);
diff --git a/Subsurface/Source/GUI/GUITextBox.cs b/Subsurface/Source/GUI/GUITextBox.cs
index aa0fe900f..2390cb7d7 100644
--- a/Subsurface/Source/GUI/GUITextBox.cs
+++ b/Subsurface/Source/GUI/GUITextBox.cs
@@ -152,19 +152,19 @@ namespace Barotrauma
}
}
- public GUITextBox(Rectangle rect, GUIStyle style = null, GUIComponent parent = null)
+ public GUITextBox(Rectangle rect, string style = null, GUIComponent parent = null)
: this(rect, null, null, Alignment.Left, Alignment.Left, style, parent)
{
}
- public GUITextBox(Rectangle rect, Alignment alignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null)
+ public GUITextBox(Rectangle rect, Alignment alignment = Alignment.Left, string style = null, GUIComponent parent = null)
: this(rect, null, null, alignment, Alignment.Left, style, parent)
{
}
- public GUITextBox(Rectangle rect, Color? color, Color? textColor, Alignment alignment, Alignment textAlignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null)
+ public GUITextBox(Rectangle rect, Color? color, Color? textColor, Alignment alignment, Alignment textAlignment = Alignment.CenterLeft, string style = null, GUIComponent parent = null)
: base(style)
{
Enabled = true;
@@ -174,8 +174,6 @@ namespace Barotrauma
if (color != null) this.color = (Color)color;
this.alignment = alignment;
-
- //this.textAlignment = textAlignment;
if (parent != null)
parent.AddChild(this);
@@ -184,13 +182,10 @@ namespace Barotrauma
Font = GUI.Font;
- if (style != null) style.Apply(textBlock, this);
+ GUI.Style.Apply(textBlock, style == "" ? "GUITextBox" : style);
textBlock.Padding = new Vector4(3.0f, 0.0f, 3.0f, 0.0f);
-
- //previousMouse = PlayerInput.GetMouseState;
-
+
CaretEnabled = true;
- //SetTextPos();
}
public void Select()
@@ -235,7 +230,6 @@ namespace Barotrauma
state = ComponentState.None;
}
- textBlock.State = state;
if (CaretEnabled)
{
@@ -245,6 +239,7 @@ namespace Barotrauma
if (keyboardDispatcher.Subscriber == this)
{
+ state = ComponentState.Selected;
Character.DisableControls = true;
if (OnEnterPressed != null && PlayerInput.KeyHit(Keys.Enter))
{
@@ -261,6 +256,7 @@ namespace Barotrauma
}
+ textBlock.State = state;
textBlock.Update(deltaTime);
}
diff --git a/Subsurface/Source/GUI/GUITickBox.cs b/Subsurface/Source/GUI/GUITickBox.cs
index c54a620dc..ae1f3c69f 100644
--- a/Subsurface/Source/GUI/GUITickBox.cs
+++ b/Subsurface/Source/GUI/GUITickBox.cs
@@ -36,7 +36,6 @@ namespace Barotrauma
set
{
enabled = value;
- text.TextColor = enabled ? Color.White : Color.White * 0.5f;
}
}
@@ -71,13 +70,16 @@ namespace Barotrauma
if (parent != null)
parent.AddChild(this);
- box = new GUIFrame(rect, Color.DarkGray, null, this);
+ box = new GUIFrame(rect, Color.DarkGray, "", this);
box.HoverColor = Color.Gray;
box.SelectedColor = Color.DarkGray;
box.CanBeFocused = false;
-
- text = new GUITextBlock(new Rectangle(rect.Right + 10, rect.Y+2, 20, rect.Height), label, GUI.Style, this, font);
+ GUI.Style.Apply(box, "GUITickBox");
+
+ text = new GUITextBlock(new Rectangle(rect.Right, rect.Y, 20, rect.Height), label, "", Alignment.TopLeft, Alignment.Left | Alignment.CenterY, this, false, font);
+ GUI.Style.Apply(text, "GUIButtonHorizontal", this);
+
this.rect = new Rectangle(box.Rect.X, box.Rect.Y, 240, rect.Height);
Enabled = true;
@@ -87,15 +89,8 @@ namespace Barotrauma
{
if (!Visible || !Enabled) return;
- //if (MouseOn != null && MouseOn != this && !MouseOn.IsParentOf(this)) return;
-
- //if (text.Rect.Contains(PlayerInput.MousePosition)) MouseOn = this;
-
- if (MouseOn==this)//box.Rect.Contains(PlayerInput.MousePosition))
+ if (MouseOn == this)
{
- //ToolTip = this.ToolTip;
- //MouseOn = this;
-
box.State = ComponentState.Hover;
if (PlayerInput.LeftButtonHeld())
@@ -103,7 +98,6 @@ namespace Barotrauma
box.State = ComponentState.Selected;
}
-
if (PlayerInput.LeftButtonClicked())
{
Selected = !Selected;
@@ -114,24 +108,18 @@ namespace Barotrauma
{
box.State = ComponentState.None;
}
-
+
+ if (selected)
+ {
+ box.State = ComponentState.Selected;
+ }
}
public override void Draw(SpriteBatch spriteBatch)
{
if (!Visible) return;
- DrawChildren(spriteBatch);
-
- float alpha = enabled ? 1.0f : 0.8f;
-
- GUI.DrawRectangle(spriteBatch, new Rectangle(box.Rect.X + 1, box.Rect.Y + 1, box.Rect.Width - 2, box.Rect.Height - 2),
- (box.State == ComponentState.Hover ? new Color(50, 50, 50, 255) : Color.Black) * alpha, true);
-
- if (!selected) return;
- GUI.DrawRectangle(spriteBatch, new Rectangle(box.Rect.X + 5, box.Rect.Y + 5, box.Rect.Width - 10, box.Rect.Height - 10),
- Color.Green * 0.8f * alpha, true);
-
+ DrawChildren(spriteBatch);
}
}
}
diff --git a/Subsurface/Source/GameSession/CrewManager.cs b/Subsurface/Source/GameSession/CrewManager.cs
index 1f44fc11b..57f43cabe 100644
--- a/Subsurface/Source/GameSession/CrewManager.cs
+++ b/Subsurface/Source/GameSession/CrewManager.cs
@@ -19,12 +19,13 @@ namespace Barotrauma
private GUIFrame guiFrame;
private GUIListBox listBox, orderListBox;
-
- private bool crewFrameOpen;
- //private GUIButton crewButton;
- protected GUIFrame crewFrame;
-
+
private CrewCommander commander;
+
+ public CrewCommander CrewCommander
+ {
+ get { return commander; }
+ }
public int Money
{
@@ -38,6 +39,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;
@@ -131,11 +133,8 @@ namespace Barotrauma
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;
if (ai == null)
@@ -150,7 +149,6 @@ namespace Barotrauma
{
guiFrame.AddToGUIUpdateList();
if (commander.Frame != null) commander.Frame.AddToGUIUpdateList();
- if (crewFrameOpen) crewFrame.AddToGUIUpdateList();
}
public void Update(float deltaTime)
@@ -174,7 +172,6 @@ namespace Barotrauma
}
if (commander.Frame != null) commander.Frame.Update(deltaTime);
- if (crewFrameOpen) crewFrame.Update(deltaTime);
}
public void ReviveCharacter(Character revivedCharacter)
@@ -216,28 +213,30 @@ namespace Barotrauma
{
if (teamIDs.Count > 1)
{
- new GUITextBlock(new Rectangle(0, y - 20, 100, 20), CombatMission.GetTeamName(teamIDs[i]), GUI.Style, crewFrame);
+ new GUITextBlock(new Rectangle(0, y - 20, 100, 20), CombatMission.GetTeamName(teamIDs[i]), "", crewFrame);
}
- GUIListBox crewList = new GUIListBox(new Rectangle(0, y, 280, listBoxHeight), Color.White * 0.7f, GUI.Style, crewFrame);
+ GUIListBox crewList = new GUIListBox(new Rectangle(0, y, 280, listBoxHeight), Color.White * 0.7f, "", crewFrame);
crewList.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
- crewList.OnSelected = SelectCrewCharacter;
+ crewList.OnSelected = (component, obj) =>
+ {
+ SelectCrewCharacter(component.UserData as Character, crewList);
+ return true;
+ };
foreach (Character character in crew.FindAll(c => c.TeamID == teamIDs[i]))
{
- GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, null, crewList);
+ GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, "ListBoxElement", crewList);
frame.UserData = character;
frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
frame.Color = (GameMain.NetworkMember != null && GameMain.NetworkMember.Character == character) ? Color.Gold * 0.2f : Color.Transparent;
- frame.HoverColor = Color.LightGray * 0.5f;
- frame.SelectedColor = Color.Gold * 0.5f;
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(40, 0, 0, 25),
ToolBox.LimitString(character.Info.Name + " (" + character.Info.Job.Name + ")", GUI.Font, frame.Rect.Width-20),
- Color.Transparent, Color.White,
+ null,null,
Alignment.Left, Alignment.Left,
- null, frame);
+ "", frame);
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
new GUIImage(new Rectangle(-10, 0, 0, 0), character.AnimController.Limbs[0].sprite, Alignment.Left, frame);
@@ -249,29 +248,20 @@ namespace Barotrauma
}
- protected virtual bool SelectCrewCharacter(GUIComponent component, object obj)
+ protected virtual bool SelectCrewCharacter(Character character, GUIComponent crewList)
{
- Character character = obj as Character;
- if (character == null) return false;
-
- var crewFrame = component.Parent;
- while (crewFrame.Parent!=null)
- {
- crewFrame = crewFrame.Parent;
- }
-
- GUIComponent existingFrame = crewFrame.FindChild("selectedcharacter");
- if (existingFrame != null) crewFrame.RemoveChild(existingFrame);
+ GUIComponent existingFrame = crewList.Parent.FindChild("selectedcharacter");
+ if (existingFrame != null) crewList.Parent.RemoveChild(existingFrame);
var previewPlayer = new GUIFrame(
new Rectangle(0, 0, 230, 300),
- new Color(0.0f, 0.0f, 0.0f, 0.8f), Alignment.TopRight, GUI.Style, crewFrame);
+ new Color(0.0f, 0.0f, 0.0f, 0.8f), Alignment.TopRight, "", crewList.Parent);
previewPlayer.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
previewPlayer.UserData = "selectedcharacter";
character.Info.CreateInfoFrame(previewPlayer);
- if (GameMain.NetworkMember != null) GameMain.NetworkMember.SelectCrewCharacter(component, obj);
+ if (GameMain.NetworkMember != null) GameMain.NetworkMember.SelectCrewCharacter(character, crewList);
return true;
}
@@ -347,7 +337,6 @@ namespace Barotrauma
else
{
guiFrame.Draw(spriteBatch);
- if (crewFrameOpen) crewFrame.Draw(spriteBatch);
}
}
diff --git a/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs b/Subsurface/Source/GameSession/GameModes/SinglePlayerMode.cs
index 245bcc0d7..6e009d941 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, GUI.Style);
+ 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;
@@ -301,11 +301,11 @@ namespace Barotrauma
summaryScreen = summaryScreen.children[0];
summaryScreen.RemoveChild(summaryScreen.children.Find(c => c is GUIButton));
- var okButton = new GUIButton(new Rectangle(-120, 0, 100, 30), "Load game", Alignment.BottomRight, GUI.Style, summaryScreen);
+ var okButton = new GUIButton(new Rectangle(-120, 0, 100, 30), "Load game", Alignment.BottomRight, "", summaryScreen);
okButton.OnClicked += GameMain.GameSession.LoadPrevious;
okButton.OnClicked += (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Remove(GUIMessageBox.VisibleBox); return true; };
- var quitButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Quit", Alignment.BottomRight, GUI.Style, summaryScreen);
+ var quitButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Quit", Alignment.BottomRight, "", summaryScreen);
quitButton.OnClicked += GameMain.LobbyScreen.QuitToMainMenu;
quitButton.OnClicked += (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Remove(GUIMessageBox.VisibleBox); return true; };
}
diff --git a/Subsurface/Source/GameSession/GameModes/Tutorials/TutorialType.cs b/Subsurface/Source/GameSession/GameModes/Tutorials/TutorialType.cs
index 2cfe573aa..3d403bfe0 100644
--- a/Subsurface/Source/GameSession/GameModes/Tutorials/TutorialType.cs
+++ b/Subsurface/Source/GameSession/GameModes/Tutorials/TutorialType.cs
@@ -151,16 +151,16 @@ namespace Barotrauma.Tutorials
height += wrappedText.Split('\n').Length * 25;
- var infoBlock = new GUIFrame(new Rectangle(-20, 20, width, height), null, Alignment.TopRight, GUI.Style);
+ var infoBlock = new GUIFrame(new Rectangle(-20, 20, width, height), null, Alignment.TopRight, "");
//infoBlock.Color = infoBlock.Color * 0.8f;
infoBlock.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
infoBlock.Flash(Color.Green);
- var textBlock = new GUITextBlock(new Rectangle(10, 10, width - 40, height), text, GUI.Style, infoBlock, true);
+ var textBlock = new GUITextBlock(new Rectangle(10, 10, width - 40, height), text, "", infoBlock, true);
if (hasButton)
{
- var okButton = new GUIButton(new Rectangle(0, -40, 80, 25), "OK", Alignment.BottomCenter, GUI.Style, textBlock);
+ var okButton = new GUIButton(new Rectangle(0, -40, 80, 25), "OK", Alignment.BottomCenter, "", textBlock);
okButton.OnClicked = CloseInfoFrame;
}
diff --git a/Subsurface/Source/GameSession/GameSession.cs b/Subsurface/Source/GameSession/GameSession.cs
index 39ef3e848..7da8026cd 100644
--- a/Subsurface/Source/GameSession/GameSession.cs
+++ b/Subsurface/Source/GameSession/GameSession.cs
@@ -112,7 +112,7 @@ namespace Barotrauma
this.saveFile = saveFile;
- infoButton = new GUIButton(new Rectangle(10, 10, 100, 20), "Info", GUI.Style, null);
+ infoButton = new GUIButton(new Rectangle(10, 10, 100, 20), "Info", "", null);
infoButton.OnClicked = ToggleInfoFrame;
if (gameModePreset != null) gameMode = gameModePreset.Instantiate(missionType);
@@ -242,7 +242,7 @@ namespace Barotrauma
{
GUIFrame summaryFrame = shiftSummary.CreateSummaryFrame(endMessage);
GUIMessageBox.MessageBoxes.Add(summaryFrame);
- var okButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Ok", Alignment.BottomRight, GUI.Style, summaryFrame.children[0]);
+ var okButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Ok", Alignment.BottomRight, "", summaryFrame.children[0]);
okButton.OnClicked = (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Remove(summaryFrame); return true; };
}
@@ -279,6 +279,11 @@ namespace Barotrauma
{
if (infoFrame == null)
{
+ if (CrewManager != null && CrewManager.CrewCommander!= null && CrewManager.CrewCommander.IsOpen)
+ {
+ CrewManager.CrewCommander.ToggleGUIFrame();
+ }
+
CreateInfoFrame();
SelectInfoFrameTab(null, selectedTab);
}
@@ -294,27 +299,31 @@ namespace Barotrauma
{
int width = 600, height = 400;
+
infoFrame = new GUIFrame(
- new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style);
+ Rectangle.Empty, Color.Black * 0.8f, null);
+
+ var innerFrame = new GUIFrame(
+ new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "", infoFrame);
- infoFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
+ innerFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
- var crewButton = new GUIButton(new Rectangle(0, -30, 100, 20), "Crew", GUI.Style, infoFrame);
+ var crewButton = new GUIButton(new Rectangle(0, -30, 100, 20), "Crew", "", innerFrame);
crewButton.UserData = InfoFrameTab.Crew;
crewButton.OnClicked = SelectInfoFrameTab;
- var missionButton = new GUIButton(new Rectangle(100, -30, 100, 20), "Mission", GUI.Style, infoFrame);
+ var missionButton = new GUIButton(new Rectangle(100, -30, 100, 20), "Mission", "", innerFrame);
missionButton.UserData = InfoFrameTab.Mission;
missionButton.OnClicked = SelectInfoFrameTab;
if (GameMain.Server != null)
{
- var manageButton = new GUIButton(new Rectangle(200, -30, 130, 20), "Manage players", GUI.Style, infoFrame);
+ var manageButton = new GUIButton(new Rectangle(200, -30, 130, 20), "Manage players", "", innerFrame);
manageButton.UserData = InfoFrameTab.ManagePlayers;
manageButton.OnClicked = SelectInfoFrameTab;
}
- var closeButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Close", Alignment.BottomCenter, GUI.Style, infoFrame);
+ var closeButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Close", Alignment.BottomCenter, "", innerFrame);
closeButton.OnClicked = ToggleInfoFrame;
}
@@ -328,13 +337,13 @@ namespace Barotrauma
switch (selectedTab)
{
case InfoFrameTab.Crew:
- CrewManager.CreateCrewFrame(CrewManager.characters, infoFrame);
+ CrewManager.CreateCrewFrame(CrewManager.characters, infoFrame.children[0] as GUIFrame);
break;
case InfoFrameTab.Mission:
- CreateMissionInfo(infoFrame);
+ CreateMissionInfo(infoFrame.children[0] as GUIFrame);
break;
case InfoFrameTab.ManagePlayers:
- GameMain.Server.ManagePlayersFrame(infoFrame);
+ GameMain.Server.ManagePlayersFrame(infoFrame.children[0] as GUIFrame);
break;
}
@@ -345,26 +354,24 @@ namespace Barotrauma
{
if (Mission == null)
{
- new GUITextBlock(new Rectangle(0,0,0,50), "No mission", GUI.Style, infoFrame, true);
+ new GUITextBlock(new Rectangle(0,0,0,50), "No mission", "", infoFrame, true);
return;
}
- new GUITextBlock(new Rectangle(0, 0, 0, 40), Mission.Name, GUI.Style, infoFrame, GUI.LargeFont);
+ new GUITextBlock(new Rectangle(0, 0, 0, 40), Mission.Name, "", infoFrame, GUI.LargeFont);
- new GUITextBlock(new Rectangle(0, 50, 0, 20), "Reward: "+Mission.Reward, GUI.Style, infoFrame, true);
- new GUITextBlock(new Rectangle(0, 70, 0, 50), Mission.Description, GUI.Style, infoFrame, true);
+ new GUITextBlock(new Rectangle(0, 50, 0, 20), "Reward: "+Mission.Reward, "", infoFrame, true);
+ new GUITextBlock(new Rectangle(0, 70, 0, 50), Mission.Description, "", infoFrame, true);
}
public void AddToGUIUpdateList()
{
- if (CrewManager != null) CrewManager.AddToGUIUpdateList();
-
- if (gameMode != null) gameMode.AddToGUIUpdateList();
-
infoButton.AddToGUIUpdateList();
-
+
+ if (gameMode != null) gameMode.AddToGUIUpdateList();
+
if (infoFrame != null) infoFrame.AddToGUIUpdateList();
}
@@ -379,7 +386,15 @@ namespace Barotrauma
if (gameMode != null) gameMode.Update(deltaTime);
if (Mission != null) Mission.Update(deltaTime);
- if (infoFrame != null) infoFrame.Update(deltaTime);
+ if (infoFrame != null)
+ {
+ infoFrame.Update(deltaTime);
+
+ if (CrewManager != null && CrewManager.CrewCommander != null && CrewManager.CrewCommander.IsOpen)
+ {
+ infoFrame = null;
+ }
+ }
}
public void Draw(SpriteBatch spriteBatch)
diff --git a/Subsurface/Source/GameSession/ShiftSummary.cs b/Subsurface/Source/GameSession/ShiftSummary.cs
index a9b9e2a48..d4227a667 100644
--- a/Subsurface/Source/GameSession/ShiftSummary.cs
+++ b/Subsurface/Source/GameSession/ShiftSummary.cs
@@ -37,7 +37,7 @@ namespace Barotrauma
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.8f);
int width = 760, height = 400;
- GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, width, height), null, Alignment.Center, GUI.Style, frame);
+ GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, width, height), null, Alignment.Center, "", frame);
int y = 0;
@@ -46,22 +46,22 @@ namespace Barotrauma
string summaryText = InfoTextManager.GetInfoText(gameOver ? "gameover" :
(progress ? "progress" : "return"));
- var infoText = new GUITextBlock(new Rectangle(0, y, 0, 50), summaryText, GUI.Style, innerFrame, true);
+ var infoText = new GUITextBlock(new Rectangle(0, y, 0, 50), summaryText, "", innerFrame, true);
y += infoText.Rect.Height;
}
if (!string.IsNullOrWhiteSpace(endMessage))
{
- var endText = new GUITextBlock(new Rectangle(0, y, 0, 30), endMessage, GUI.Style, innerFrame, true);
+ var endText = new GUITextBlock(new Rectangle(0, y, 0, 30), endMessage, "", innerFrame, true);
y += 30 + endText.Text.Split('\n').Length * 20;
}
- new GUITextBlock(new Rectangle(0, y, 0, 20), "Crew status:", GUI.Style, innerFrame, GUI.LargeFont);
+ new GUITextBlock(new Rectangle(0, y, 0, 20), "Crew status:", "", innerFrame, GUI.LargeFont);
y += 30;
- GUIListBox listBox = new GUIListBox(new Rectangle(0,y,0,90), null, Alignment.TopLeft, GUI.Style, innerFrame, true);
+ GUIListBox listBox = new GUIListBox(new Rectangle(0,y,0,90), null, Alignment.TopLeft, "", innerFrame, true);
int x = 0;
foreach (Character character in gameSession.CrewManager.characters)
@@ -72,7 +72,7 @@ namespace Barotrauma
continue;
}
- var characterFrame = new GUIFrame(new Rectangle(x, y, 170, 70), Color.Transparent, GUI.Style, listBox);
+ var characterFrame = new GUIFrame(new Rectangle(x, y, 170, 70), Color.Transparent, "", listBox);
characterFrame.OutlineColor = Color.Transparent;
characterFrame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
characterFrame.CanBeFocused = false;
@@ -105,7 +105,7 @@ namespace Barotrauma
}
new GUITextBlock(new Rectangle(0, 0, 0, 20), statusText,
- GUI.Style, Alignment.BottomLeft, Alignment.TopCenter, characterFrame, true, GUI.SmallFont).Color = statusColor * 0.7f;
+ "", Alignment.BottomLeft, Alignment.TopCenter, characterFrame, true, GUI.SmallFont).Color = statusColor * 0.7f;
x += characterFrame.Rect.Width + 10;
}
@@ -114,17 +114,17 @@ namespace Barotrauma
if (GameMain.GameSession.Mission != null)
{
- new GUITextBlock(new Rectangle(0, y, 0, 20), "Mission: " + GameMain.GameSession.Mission.Name, GUI.Style, innerFrame, GUI.LargeFont);
+ new GUITextBlock(new Rectangle(0, y, 0, 20), "Mission: " + GameMain.GameSession.Mission.Name, "", innerFrame, GUI.LargeFont);
y += 30;
new GUITextBlock(new Rectangle(0, y, innerFrame.Rect.Width - 170, 0),
(GameMain.GameSession.Mission.Completed) ? GameMain.GameSession.Mission.SuccessMessage : GameMain.GameSession.Mission.FailureMessage,
- GUI.Style, innerFrame, true);
+ "", innerFrame, true);
//y += 50;
if (GameMain.GameSession.Mission.Completed && singleplayer)
{
- new GUITextBlock(new Rectangle(0, 0, 0, 30), "Reward: " + GameMain.GameSession.Mission.Reward, GUI.Style, Alignment.BottomLeft, Alignment.BottomLeft, innerFrame);
+ new GUITextBlock(new Rectangle(0, 0, 0, 30), "Reward: " + GameMain.GameSession.Mission.Reward, "", Alignment.BottomLeft, Alignment.BottomLeft, innerFrame);
//y += 30;
}
}
diff --git a/Subsurface/Source/GameSettings.cs b/Subsurface/Source/GameSettings.cs
index 695a02283..df02b1033 100644
--- a/Subsurface/Source/GameSettings.cs
+++ b/Subsurface/Source/GameSettings.cs
@@ -317,14 +317,14 @@ namespace Barotrauma
private void CreateSettingsFrame()
{
- settingsFrame = new GUIFrame(new Rectangle(0, 0, 500, 500), null, Alignment.Center, GUI.Style);
+ settingsFrame = new GUIFrame(new Rectangle(0, 0, 500, 500), null, Alignment.Center, "");
- new GUITextBlock(new Rectangle(0,-30,0,30), "Settings",GUI.Style,Alignment.TopCenter, Alignment.TopCenter, settingsFrame, false, GUI.LargeFont);
+ new GUITextBlock(new Rectangle(0, -30, 0, 30), "Settings", "", Alignment.TopCenter, Alignment.TopCenter, settingsFrame, false, GUI.LargeFont);
- int x=0, y = 10;
+ int x = 0, y = 10;
- new GUITextBlock(new Rectangle(0, y, 20, 20), "Resolution", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
- var resolutionDD = new GUIDropDown(new Rectangle(0, y + 20, 180, 20), "", GUI.Style, settingsFrame);
+ new GUITextBlock(new Rectangle(0, y, 20, 20), "Resolution", "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
+ var resolutionDD = new GUIDropDown(new Rectangle(0, y + 20, 180, 20), "", "", settingsFrame);
resolutionDD.OnSelected = SelectResolution;
var supportedModes = new List();
@@ -349,8 +349,8 @@ namespace Barotrauma
//fullScreenTick.OnSelected = ToggleFullScreen;
//fullScreenTick.Selected = FullScreenEnabled;
- new GUITextBlock(new Rectangle(x, y, 20, 20), "Display mode", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
- var displayModeDD = new GUIDropDown(new Rectangle(x, y + 20, 180, 20), "", GUI.Style, settingsFrame);
+ new GUITextBlock(new Rectangle(x, y, 20, 20), "Display mode", "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
+ var displayModeDD = new GUIDropDown(new Rectangle(x, y + 20, 180, 20), "", "", settingsFrame);
displayModeDD.AddItem("Fullscreen", WindowMode.Fullscreen);
displayModeDD.AddItem("Windowed", WindowMode.Windowed);
displayModeDD.AddItem("Borderless windowed", WindowMode.BorderlessWindowed);
@@ -375,14 +375,14 @@ namespace Barotrauma
y += 70;
- new GUITextBlock(new Rectangle(0, y, 100, 20), "Sound volume:", GUI.Style, settingsFrame);
- GUIScrollBar soundScrollBar = new GUIScrollBar(new Rectangle(0, y + 20, 150, 20), GUI.Style, 0.1f, settingsFrame);
+ new GUITextBlock(new Rectangle(0, y, 100, 20), "Sound volume:", "", settingsFrame);
+ GUIScrollBar soundScrollBar = new GUIScrollBar(new Rectangle(0, y + 20, 150, 20), "", 0.1f, settingsFrame);
soundScrollBar.BarScroll = SoundVolume;
soundScrollBar.OnMoved = ChangeSoundVolume;
soundScrollBar.Step = 0.05f;
- new GUITextBlock(new Rectangle(0, y + 40, 100, 20), "Music volume:", GUI.Style, settingsFrame);
- GUIScrollBar musicScrollBar = new GUIScrollBar(new Rectangle(0, y + 60, 150, 20), GUI.Style, 0.1f, settingsFrame);
+ new GUITextBlock(new Rectangle(0, y + 40, 100, 20), "Music volume:", "", settingsFrame);
+ GUIScrollBar musicScrollBar = new GUIScrollBar(new Rectangle(0, y + 60, 150, 20), "", 0.1f, settingsFrame);
musicScrollBar.BarScroll = MusicVolume;
musicScrollBar.OnMoved = ChangeMusicVolume;
musicScrollBar.Step = 0.05f;
@@ -390,8 +390,8 @@ namespace Barotrauma
x = 200;
y = 10;
- new GUITextBlock(new Rectangle(x, y, 20, 20), "Content package", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
- var contentPackageDD = new GUIDropDown(new Rectangle(x, y + 20, 200, 20), "", GUI.Style, settingsFrame);
+ new GUITextBlock(new Rectangle(x, y, 20, 20), "Content package", "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
+ var contentPackageDD = new GUIDropDown(new Rectangle(x, y + 20, 200, 20), "", "", settingsFrame);
foreach (ContentPackage contentPackage in ContentPackage.list)
{
@@ -401,13 +401,13 @@ namespace Barotrauma
}
y += 50;
- new GUITextBlock(new Rectangle(x, y, 100, 20), "Controls:", GUI.Style, settingsFrame);
+ new GUITextBlock(new Rectangle(x, y, 100, 20), "Controls:", "", settingsFrame);
y += 30;
var inputNames = Enum.GetNames(typeof(InputType));
for (int i = 0; i< inputNames.Length; i++)
{
- new GUITextBlock(new Rectangle(x, y, 100, 20), inputNames[i]+": ", GUI.Style, settingsFrame);
- var keyBox = new GUITextBox(new Rectangle(x + 100, y, 120, 15), GUI.Style, settingsFrame);
+ new GUITextBlock(new Rectangle(x, y, 100, 18), inputNames[i]+": ", "", Alignment.TopLeft, Alignment.CenterLeft, settingsFrame);
+ var keyBox = new GUITextBox(new Rectangle(x + 100, y, 120, 18), null,null, Alignment.TopLeft, Alignment.CenterLeft, "", settingsFrame);
keyBox.Text = keyMapping[i].ToString();
keyBox.UserData = i;
@@ -417,7 +417,7 @@ namespace Barotrauma
y += 20;
}
- applyButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Apply", Alignment.BottomRight, GUI.Style, settingsFrame);
+ applyButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Apply", Alignment.BottomRight, "", settingsFrame);
applyButton.OnClicked = ApplyClicked;
}
diff --git a/Subsurface/Source/Items/CharacterInventory.cs b/Subsurface/Source/Items/CharacterInventory.cs
index 5f258a8c7..49a0d64ed 100644
--- a/Subsurface/Source/Items/CharacterInventory.cs
+++ b/Subsurface/Source/Items/CharacterInventory.cs
@@ -65,7 +65,7 @@ namespace Barotrauma
useOnSelfButton[i - 3] = new GUIButton(
new Rectangle((int) SlotPositions[i].X, (int) (SlotPositions[i].Y - spacing - rectHeight),
- rectWidth, rectHeight), "Use", GUI.Style)
+ rectWidth, rectHeight), "Use", "")
{
UserData = i,
OnClicked = UseItemOnSelf
diff --git a/Subsurface/Source/Items/Components/ItemComponent.cs b/Subsurface/Source/Items/Components/ItemComponent.cs
index ed5dd2841..411279321 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
{
@@ -286,6 +285,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);
@@ -301,9 +302,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, GUI.Style);
- //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/Deconstructor.cs b/Subsurface/Source/Items/Components/Machines/Deconstructor.cs
index 128f1f525..ec2e3773b 100644
--- a/Subsurface/Source/Items/Components/Machines/Deconstructor.cs
+++ b/Subsurface/Source/Items/Components/Machines/Deconstructor.cs
@@ -22,9 +22,9 @@ namespace Barotrauma.Items.Components
public Deconstructor(Item item, XElement element)
: base(item, element)
{
- progressBar = new GUIProgressBar(new Rectangle(0,0,200,20), Color.Green, GUI.Style, 0.0f, Alignment.BottomCenter, GuiFrame);
+ progressBar = new GUIProgressBar(new Rectangle(0,0,200,20), Color.Green, "", 0.0f, Alignment.BottomCenter, GuiFrame);
- activateButton = new GUIButton(new Rectangle(0, 0, 200, 20), "Deconstruct", Alignment.TopCenter, GUI.Style, GuiFrame);
+ activateButton = new GUIButton(new Rectangle(0, 0, 200, 20), "Deconstruct", Alignment.TopCenter, "", GuiFrame);
activateButton.OnClicked = ToggleActive;
}
diff --git a/Subsurface/Source/Items/Components/Machines/Engine.cs b/Subsurface/Source/Items/Components/Machines/Engine.cs
index 5e50936e5..501f2673e 100644
--- a/Subsurface/Source/Items/Components/Machines/Engine.cs
+++ b/Subsurface/Source/Items/Components/Machines/Engine.cs
@@ -49,7 +49,7 @@ namespace Barotrauma.Items.Components
{
IsActive = true;
- var button = new GUIButton(new Rectangle(160, 50, 30, 30), "-", GUI.Style, GuiFrame);
+ var button = new GUIButton(new Rectangle(160, 50, 30, 30), "-", "", GuiFrame);
button.OnClicked = (GUIButton btn, object obj) =>
{
targetForce -= 1.0f;
@@ -57,7 +57,7 @@ namespace Barotrauma.Items.Components
return true;
};
- button = new GUIButton(new Rectangle(200, 50, 30, 30), "+", GUI.Style, GuiFrame);
+ button = new GUIButton(new Rectangle(200, 50, 30, 30), "+", "", GuiFrame);
button.OnClicked = (GUIButton btn, object obj) =>
{
targetForce += 1.0f;
diff --git a/Subsurface/Source/Items/Components/Machines/Fabricator.cs b/Subsurface/Source/Items/Components/Machines/Fabricator.cs
index 252e6be16..0184b2a44 100644
--- a/Subsurface/Source/Items/Components/Machines/Fabricator.cs
+++ b/Subsurface/Source/Items/Components/Machines/Fabricator.cs
@@ -112,7 +112,7 @@ namespace Barotrauma.Items.Components
GuiFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
- itemList = new GUIListBox(new Rectangle(0,0,GuiFrame.Rect.Width/2-20,0), GUI.Style, GuiFrame);
+ itemList = new GUIListBox(new Rectangle(0,0,GuiFrame.Rect.Width/2-20,0), "", GuiFrame);
itemList.OnSelected = SelectItem;
foreach (FabricableItem fi in fabricableItems)
@@ -158,7 +158,7 @@ namespace Barotrauma.Items.Components
selectedItemFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
- progressBar = new GUIProgressBar(new Rectangle(0, 0, 0, 20), Color.Green, GUI.Style, 0.0f, Alignment.BottomCenter, selectedItemFrame);
+ progressBar = new GUIProgressBar(new Rectangle(0, 0, 0, 20), Color.Green, "", 0.0f, Alignment.BottomCenter, selectedItemFrame);
progressBar.IsHorizontal = true;
if (targetItem.TargetItem.sprite != null)
@@ -184,7 +184,7 @@ namespace Barotrauma.Items.Components
var description = new GUITextBlock(
new Rectangle(0, y, 0, 0),
targetItem.TargetItem.Description,
- GUI.Style, Alignment.TopLeft, Alignment.TopLeft,
+ "", Alignment.TopLeft, Alignment.TopLeft,
selectedItemFrame, true, GUI.SmallFont);
y += description.Rect.Height + 10;
@@ -228,7 +228,7 @@ namespace Barotrauma.Items.Components
Alignment.TopLeft, null,
selectedItemFrame);
- activateButton = new GUIButton(new Rectangle(0, -30, 100, 20), "Create", Color.White, Alignment.CenterX | Alignment.Bottom, GUI.Style, selectedItemFrame);
+ activateButton = new GUIButton(new Rectangle(0, -30, 100, 20), "Create", Color.White, Alignment.CenterX | Alignment.Bottom, "", selectedItemFrame);
activateButton.OnClicked = StartButtonClicked;
activateButton.UserData = targetItem;
activateButton.Enabled = false;
diff --git a/Subsurface/Source/Items/Components/Machines/Pump.cs b/Subsurface/Source/Items/Components/Machines/Pump.cs
index dba76a360..2d061d5f4 100644
--- a/Subsurface/Source/Items/Components/Machines/Pump.cs
+++ b/Subsurface/Source/Items/Components/Machines/Pump.cs
@@ -87,7 +87,7 @@ namespace Barotrauma.Items.Components
return true;
};
- var button = new GUIButton(new Rectangle(160, 40, 35, 30), "OUT", GUI.Style, GuiFrame);
+ var button = new GUIButton(new Rectangle(160, 40, 35, 30), "OUT", "", GuiFrame);
button.OnClicked = (GUIButton btn, object obj) =>
{
FlowPercentage -= 10.0f;
@@ -105,7 +105,7 @@ namespace Barotrauma.Items.Components
return true;
};
- button = new GUIButton(new Rectangle(210, 40, 35, 30), "IN", GUI.Style, GuiFrame);
+ button = new GUIButton(new Rectangle(210, 40, 35, 30), "IN", "", GuiFrame);
button.OnClicked = (GUIButton btn, object obj) =>
{
FlowPercentage += 10.0f;
diff --git a/Subsurface/Source/Items/Components/Machines/Radar.cs b/Subsurface/Source/Items/Components/Machines/Radar.cs
index 1564d6bef..5f69f0ddb 100644
--- a/Subsurface/Source/Items/Components/Machines/Radar.cs
+++ b/Subsurface/Source/Items/Components/Machines/Radar.cs
@@ -123,7 +123,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/Items/Components/Machines/Reactor.cs b/Subsurface/Source/Items/Components/Machines/Reactor.cs
index 201336b66..dc7cdbd84 100644
--- a/Subsurface/Source/Items/Components/Machines/Reactor.cs
+++ b/Subsurface/Source/Items/Components/Machines/Reactor.cs
@@ -159,7 +159,7 @@ namespace Barotrauma.Items.Components
IsActive = true;
- var button = new GUIButton(new Rectangle(410, 70, 40, 40), "-", GUI.Style, GuiFrame);
+ var button = new GUIButton(new Rectangle(410, 70, 40, 40), "-", "", GuiFrame);
button.OnPressed = () =>
{
unsentChanges = true;
@@ -168,7 +168,7 @@ namespace Barotrauma.Items.Components
return false;
};
- button = new GUIButton(new Rectangle(460, 70, 40,40), "+", GUI.Style, GuiFrame);
+ button = new GUIButton(new Rectangle(460, 70, 40,40), "+", "", GuiFrame);
button.OnPressed = () =>
{
unsentChanges = true;
@@ -180,7 +180,7 @@ namespace Barotrauma.Items.Components
autoTempTickBox = new GUITickBox(new Rectangle(410, 170, 20, 20), "Automatic temperature control", Alignment.TopLeft, GuiFrame);
autoTempTickBox.OnSelected = ToggleAutoTemp;
- button = new GUIButton(new Rectangle(210, 290, 40, 40), "+", GUI.Style, GuiFrame);
+ button = new GUIButton(new Rectangle(210, 290, 40, 40), "+", "", GuiFrame);
button.OnPressed = () =>
{
unsentChanges = true;
@@ -189,7 +189,7 @@ namespace Barotrauma.Items.Components
return false;
};
- button = new GUIButton(new Rectangle(210, 340, 40, 40), "-", GUI.Style, GuiFrame);
+ button = new GUIButton(new Rectangle(210, 340, 40, 40), "-", "", GuiFrame);
button.OnPressed = () =>
{
unsentChanges = true;
@@ -198,7 +198,7 @@ namespace Barotrauma.Items.Components
return false;
};
- button = new GUIButton(new Rectangle(500, 290, 40, 40), "+", GUI.Style, GuiFrame);
+ button = new GUIButton(new Rectangle(500, 290, 40, 40), "+", "", GuiFrame);
button.OnPressed = () =>
{
unsentChanges = true;
@@ -207,7 +207,7 @@ namespace Barotrauma.Items.Components
return false;
};
- button = new GUIButton(new Rectangle(500, 340, 40, 40), "-", GUI.Style, GuiFrame);
+ button = new GUIButton(new Rectangle(500, 340, 40, 40), "-", "", GuiFrame);
button.OnPressed = () =>
{
unsentChanges = true;
diff --git a/Subsurface/Source/Items/Components/Power/PowerContainer.cs b/Subsurface/Source/Items/Components/Power/PowerContainer.cs
index 859f161e7..960f3eb7a 100644
--- a/Subsurface/Source/Items/Components/Power/PowerContainer.cs
+++ b/Subsurface/Source/Items/Components/Power/PowerContainer.cs
@@ -94,7 +94,7 @@ namespace Barotrauma.Items.Components
if (canBeSelected)
{
- var button = new GUIButton(new Rectangle(160, 50, 30,30), "-", GUI.Style, GuiFrame);
+ var button = new GUIButton(new Rectangle(160, 50, 30,30), "-", "", GuiFrame);
button.OnClicked = (GUIButton btn, object obj) =>
{
RechargeSpeed = rechargeSpeed - maxRechargeSpeed * 0.1f;
@@ -112,7 +112,7 @@ namespace Barotrauma.Items.Components
return true;
};
- button = new GUIButton(new Rectangle(200, 50, 30, 30), "+", GUI.Style, GuiFrame);
+ button = new GUIButton(new Rectangle(200, 50, 30, 30), "+", "", GuiFrame);
button.OnClicked = (GUIButton btn, object obj) =>
{
RechargeSpeed = rechargeSpeed + maxRechargeSpeed * 0.1f;
diff --git a/Subsurface/Source/Items/FixRequirement.cs b/Subsurface/Source/Items/FixRequirement.cs
index 503176b6b..8aa532429 100644
--- a/Subsurface/Source/Items/FixRequirement.cs
+++ b/Subsurface/Source/Items/FixRequirement.cs
@@ -89,11 +89,11 @@ namespace Barotrauma
int width = 400, height = 500;
int y = 0;
- frame = new GUIFrame(new Rectangle(0, 0, width, height), null, Alignment.Center, GUI.Style);
+ frame = new GUIFrame(new Rectangle(0, 0, width, height), null, Alignment.Center, "");
frame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
frame.UserData = item;
- new GUITextBlock(new Rectangle(0,0,200,20), "Attempting to fix " + item.Name, GUI.Style, frame);
+ new GUITextBlock(new Rectangle(0,0,200,20), "Attempting to fix " + item.Name, "", frame);
y = y + 40;
foreach (FixRequirement requirement in item.FixRequirements)
@@ -104,7 +104,7 @@ namespace Barotrauma
reqFrame.UserData = requirement;
- var fixButton = new GUIButton(new Rectangle(0, 0, 50, 20), "Fix", GUI.Style, reqFrame);
+ var fixButton = new GUIButton(new Rectangle(0, 0, 50, 20), "Fix", "", reqFrame);
fixButton.OnClicked = FixButtonPressed;
fixButton.UserData = requirement;
@@ -114,7 +114,7 @@ namespace Barotrauma
int y2 = 20;
foreach (string itemName in requirement.requiredItems)
{
- var itemBlock = new GUITextBlock(new Rectangle(30, y2, 200, 15), itemName, GUI.Style, reqFrame);
+ var itemBlock = new GUITextBlock(new Rectangle(30, y2, 200, 15), itemName, "", reqFrame);
itemBlock.Font = GUI.SmallFont;
itemBlock.UserData = itemName;
@@ -124,7 +124,7 @@ namespace Barotrauma
y2 = 20;
foreach (Skill skill in requirement.requiredSkills)
{
- var skillBlock = new GUITextBlock(new Rectangle(0, y2, 200, 15), skill.Name + " - " + skill.Level, GUI.Style, Alignment.Right, Alignment.TopLeft, reqFrame);
+ var skillBlock = new GUITextBlock(new Rectangle(0, y2, 200, 15), skill.Name + " - " + skill.Level, "", Alignment.Right, Alignment.TopLeft, reqFrame);
skillBlock.Font = GUI.SmallFont;
skillBlock.UserData = skill;
diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs
index 77340239e..4182de417 100644
--- a/Subsurface/Source/Items/Item.cs
+++ b/Subsurface/Source/Items/Item.cs
@@ -1060,11 +1060,11 @@ namespace Barotrauma
}
}
- editingHUD = new GUIFrame(new Rectangle(x, y, width, 70 + (editableProperties.Count() + requiredItemCount) * 30), GUI.Style);
+ editingHUD = new GUIFrame(new Rectangle(x, y, width, 70 + (editableProperties.Count() + requiredItemCount) * 30), "");
editingHUD.Padding = new Vector4(10, 10, 0, 0);
editingHUD.UserData = this;
- new GUITextBlock(new Rectangle(0, 0, 100, 20), prefab.Name, GUI.Style,
+ new GUITextBlock(new Rectangle(0, 0, 100, 20), prefab.Name, "",
Alignment.TopLeft, Alignment.TopLeft, editingHUD, false, GUI.LargeFont);
y += 20;
@@ -1074,15 +1074,15 @@ namespace Barotrauma
if (prefab.IsLinkable)
{
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Hold space to link to another item",
- GUI.Style, Alignment.TopRight, Alignment.TopRight, editingHUD).Font = GUI.SmallFont;
+ "", Alignment.TopRight, Alignment.TopRight, editingHUD).Font = GUI.SmallFont;
y += 25;
}
foreach (ItemComponent ic in components)
{
foreach (RelatedItem relatedItem in ic.requiredItems)
{
- new GUITextBlock(new Rectangle(0, y, 100, 20), ic.Name + ": " + relatedItem.Type.ToString() + " required", GUI.Style, editingHUD);
- GUITextBox namesBox = new GUITextBox(new Rectangle(-10, y, 160, 20), Alignment.Right, GUI.Style, editingHUD);
+ new GUITextBlock(new Rectangle(0, y, 100, 20), ic.Name + ": " + relatedItem.Type.ToString() + " required", "", editingHUD);
+ GUITextBox namesBox = new GUITextBox(new Rectangle(-10, y, 160, 20), Alignment.Right, "", editingHUD);
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (relatedItem);
PropertyDescriptor property = properties.Find("JoinedNames", false);
@@ -1119,9 +1119,9 @@ namespace Barotrauma
else
{
- new GUITextBlock(new Rectangle(0, y, 100, 20), objectProperty.Name, Color.Transparent, Color.White, Alignment.Left, GUI.Style, editingHUD);
+ new GUITextBlock(new Rectangle(0, y, 100, 20), objectProperty.Name, Color.Transparent, Color.White, Alignment.Left, "", editingHUD);
- GUITextBox propertyBox = new GUITextBox(new Rectangle(180, y, 250, height), GUI.Style, editingHUD);
+ GUITextBox propertyBox = new GUITextBox(new Rectangle(180, y, 250, height), "", editingHUD);
if (height > 20) propertyBox.Wrap = true;
if (value != null)
diff --git a/Subsurface/Source/Map/LinkedSubmarine.cs b/Subsurface/Source/Map/LinkedSubmarine.cs
index 080b5faff..f3bc5d9f4 100644
--- a/Subsurface/Source/Map/LinkedSubmarine.cs
+++ b/Subsurface/Source/Map/LinkedSubmarine.cs
@@ -187,18 +187,18 @@ namespace Barotrauma
int width = 450;
int x = GameMain.GraphicsWidth / 2 - width / 2, y = 10;
- editingHUD = new GUIFrame(new Rectangle(x, y, width, 100), GUI.Style);
+ editingHUD = new GUIFrame(new Rectangle(x, y, width, 100), "");
editingHUD.Padding = new Vector4(10, 10, 0, 0);
editingHUD.UserData = this;
- new GUITextBlock(new Rectangle(0, 0, 100, 20), "Linked submarine", GUI.Style,
+ new GUITextBlock(new Rectangle(0, 0, 100, 20), "Linked submarine", "",
Alignment.TopLeft, Alignment.TopLeft, editingHUD, false, GUI.LargeFont);
- var pathBox = new GUITextBox(new Rectangle(10,30,300,20), GUI.Style, editingHUD);
+ var pathBox = new GUITextBox(new Rectangle(10,30,300,20), "", editingHUD);
pathBox.Font = GUI.SmallFont;
pathBox.Text = filePath;
- var reloadButton = new GUIButton(new Rectangle(320,30,80,20), "Refresh", GUI.Style, editingHUD);
+ var reloadButton = new GUIButton(new Rectangle(320,30,80,20), "Refresh", "", editingHUD);
reloadButton.OnClicked = Reload;
reloadButton.UserData = pathBox;
@@ -209,7 +209,7 @@ namespace Barotrauma
if (!inGame)
{
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Hold space to link to a docking port",
- GUI.Style, Alignment.TopRight, Alignment.TopRight, editingHUD, false, GUI.SmallFont);
+ "", Alignment.TopRight, Alignment.TopRight, editingHUD, false, GUI.SmallFont);
y += 25;
}
diff --git a/Subsurface/Source/Map/MapEntity.cs b/Subsurface/Source/Map/MapEntity.cs
index d67cf2dcc..ac79a56b6 100644
--- a/Subsurface/Source/Map/MapEntity.cs
+++ b/Subsurface/Source/Map/MapEntity.cs
@@ -655,16 +655,14 @@ namespace Barotrauma
highlightedList = highlightedEntities;
highlightedListBox = new GUIListBox(
- new Rectangle((int)PlayerInput.MousePosition.X+15, (int)PlayerInput.MousePosition.Y+15, 150, highlightedEntities.Count * 15),
- null, Alignment.TopLeft, GUI.Style, null, false);
-
- highlightedListBox.Color = Color.Black * 0.6f;
-
+ new Rectangle((int)PlayerInput.MousePosition.X+15, (int)PlayerInput.MousePosition.Y+15, 150, highlightedEntities.Count * 18 + 5),
+ null, Alignment.TopLeft, "GUIToolTip", null, false);
+
foreach (MapEntity entity in highlightedEntities)
{
var textBlock = new GUITextBlock(
- new Rectangle(0,0,0,15),
- ToolBox.LimitString(entity.Name, GUI.SmallFont, 140), GUI.Style, highlightedListBox, GUI.SmallFont);
+ new Rectangle(0, 0, highlightedListBox.Rect.Width, 18),
+ ToolBox.LimitString(entity.Name, GUI.SmallFont, 140), "", Alignment.TopLeft, Alignment.CenterLeft, highlightedListBox, false, GUI.SmallFont);
textBlock.UserData = entity;
}
diff --git a/Subsurface/Source/Map/Structure.cs b/Subsurface/Source/Map/Structure.cs
index d4077aa8f..34fc80488 100644
--- a/Subsurface/Source/Map/Structure.cs
+++ b/Subsurface/Source/Map/Structure.cs
@@ -465,14 +465,18 @@ namespace Barotrauma
GameMain.World.RemoveBody(b);
}
- foreach (WallSection s in sections)
+ if (sections != null)
{
- if (s.gap != null)
+ foreach (WallSection s in sections)
{
- s.gap.Remove();
- s.gap = null;
+ if (s.gap != null)
+ {
+ s.gap.Remove();
+ s.gap = null;
+ }
}
}
+
if (convexHulls != null) convexHulls.ForEach(x => x.Remove());
}
diff --git a/Subsurface/Source/Map/StructurePrefab.cs b/Subsurface/Source/Map/StructurePrefab.cs
index b99087775..ed551a158 100644
--- a/Subsurface/Source/Map/StructurePrefab.cs
+++ b/Subsurface/Source/Map/StructurePrefab.cs
@@ -152,11 +152,8 @@ namespace Barotrauma
public override void UpdatePlacing(Camera cam)
{
Vector2 position = Submarine.MouseToWorldGrid(cam, Submarine.MainSub);
- //Vector2 placeSize = size;
-
Rectangle newRect = new Rectangle((int)position.X, (int)position.Y, (int)size.X, (int)size.Y);
-
-
+
if (placePosition == Vector2.Zero)
{
if (PlayerInput.LeftButtonHeld())
@@ -164,8 +161,6 @@ namespace Barotrauma
newRect.X = (int)position.X;
newRect.Y = (int)position.Y;
-
- //sprite.Draw(spriteBatch, new Vector2(position.X, -position.Y), placeSize, Color.White);
}
else
{
@@ -177,10 +172,14 @@ namespace Barotrauma
if (PlayerInput.LeftButtonReleased())
{
- newRect.Location -= Submarine.MainSub.Position.ToPoint();
+ //don't allow resizing width/height to zero
+ if ((!resizeHorizontal || placeSize.X != 0.0f) && (!resizeVertical || placeSize.Y != 0.0f))
+ {
+ newRect.Location -= Submarine.MainSub.Position.ToPoint();
- var structure = new Structure(newRect, this, Submarine.MainSub);
- structure.Submarine = Submarine.MainSub;
+ var structure = new Structure(newRect, this, Submarine.MainSub);
+ structure.Submarine = Submarine.MainSub;
+ }
selected = null;
return;
diff --git a/Subsurface/Source/Map/WayPoint.cs b/Subsurface/Source/Map/WayPoint.cs
index 05626dfd8..fcaf02b5c 100644
--- a/Subsurface/Source/Map/WayPoint.cs
+++ b/Subsurface/Source/Map/WayPoint.cs
@@ -272,28 +272,28 @@ namespace Barotrauma
if (spawnType == SpawnType.Path)
{
- new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing waypoint", GUI.Style, editingHUD);
- new GUITextBlock(new Rectangle(0, 20, 100, 20), "Hold space to link to another waypoint", GUI.Style, editingHUD);
+ new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing waypoint", "", editingHUD);
+ new GUITextBlock(new Rectangle(0, 20, 100, 20), "Hold space to link to another waypoint", "", editingHUD);
}
else
{
- new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing spawnpoint", GUI.Style, editingHUD);
- new GUITextBlock(new Rectangle(0, 25, 100, 20), "Spawn type: ", GUI.Style, editingHUD);
+ new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing spawnpoint", "", editingHUD);
+ new GUITextBlock(new Rectangle(0, 25, 100, 20), "Spawn type: ", "", editingHUD);
- var spawnTypeText = new GUITextBlock(new Rectangle(0, 25, 200, 20), spawnType.ToString(), GUI.Style, Alignment.Right, Alignment.TopLeft, editingHUD);
+ var spawnTypeText = new GUITextBlock(new Rectangle(0, 25, 200, 20), spawnType.ToString(), "", Alignment.Right, Alignment.TopLeft, editingHUD);
- var button = new GUIButton(new Rectangle(-30,0,20,20), "-", Alignment.Right, GUI.Style, spawnTypeText);
+ var button = new GUIButton(new Rectangle(-30,0,20,20), "-", Alignment.Right, "", spawnTypeText);
button.UserData = -1;
button.OnClicked = ChangeSpawnType;
- button = new GUIButton(new Rectangle(0, 0, 20, 20), "+", Alignment.Right, GUI.Style, spawnTypeText);
+ button = new GUIButton(new Rectangle(0, 0, 20, 20), "+", Alignment.Right, "", spawnTypeText);
button.UserData = 1;
button.OnClicked = ChangeSpawnType;
y = 40 + 20;
new GUITextBlock(new Rectangle(0, y, 100, 20), "ID Card tags:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD);
- GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), GUI.Style, editingHUD);
+ GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), "", editingHUD);
propertyBox.Text = string.Join(", ", idCardTags);
propertyBox.OnEnterPressed = EnterIDCardTags;
propertyBox.OnTextChanged = TextBoxChanged;
@@ -302,7 +302,7 @@ namespace Barotrauma
y = y + 30;
new GUITextBlock(new Rectangle(0, y, 100, 20), "Assigned job:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD);
- propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), GUI.Style, editingHUD);
+ propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), "", editingHUD);
propertyBox.Text = (assignedJob == null) ? "None" : assignedJob.Name;
propertyBox.OnEnterPressed = EnterAssignedJob;
propertyBox.OnTextChanged = TextBoxChanged;
diff --git a/Subsurface/Source/Networking/BanList.cs b/Subsurface/Source/Networking/BanList.cs
index 8a650ed73..2bf250e52 100644
--- a/Subsurface/Source/Networking/BanList.cs
+++ b/Subsurface/Source/Networking/BanList.cs
@@ -93,24 +93,24 @@ namespace Barotrauma.Networking
public GUIComponent CreateBanFrame(GUIComponent parent)
{
- banFrame = new GUIListBox(new Rectangle(0, 0, 0, 0), GUI.Style, parent);
+ banFrame = new GUIListBox(new Rectangle(0, 0, 0, 0), "", parent);
foreach (BannedPlayer bannedPlayer in bannedPlayers)
{
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
bannedPlayer.IP + " (" + bannedPlayer.Name + ")",
- GUI.Style,
+ "",
Alignment.Left, Alignment.Left, banFrame);
textBlock.Padding = new Vector4(10.0f, 10.0f, 0.0f, 0.0f);
textBlock.UserData = banFrame;
- var removeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Remove", Alignment.Right | Alignment.CenterY, GUI.Style, textBlock);
+ var removeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Remove", Alignment.Right | Alignment.CenterY, "", textBlock);
removeButton.UserData = bannedPlayer;
removeButton.OnClicked = RemoveBan;
if (bannedPlayer.IP.IndexOf(".x") <= -1)
{
- var rangeBanButton = new GUIButton(new Rectangle(-100, 0, 100, 20), "Ban range", Alignment.Right | Alignment.CenterY, GUI.Style, textBlock);
+ var rangeBanButton = new GUIButton(new Rectangle(-100, 0, 100, 20), "Ban range", Alignment.Right | Alignment.CenterY, "", textBlock);
rangeBanButton.UserData = bannedPlayer;
rangeBanButton.OnClicked = RangeBan;
}
diff --git a/Subsurface/Source/Networking/GameClient.cs b/Subsurface/Source/Networking/GameClient.cs
index 0bbd0dc94..d87d9aaa3 100644
--- a/Subsurface/Source/Networking/GameClient.cs
+++ b/Subsurface/Source/Networking/GameClient.cs
@@ -67,7 +67,7 @@ namespace Barotrauma.Networking
endVoteTickBox.OnSelected = ToggleEndRoundVote;
endVoteTickBox.Visible = false;
- endRoundButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170 - 170, 20, 150, 20), "End round", Alignment.TopLeft, GUI.Style, inGameHUD);
+ endRoundButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170 - 170, 20, 150, 20), "End round", Alignment.TopLeft, "", inGameHUD);
endRoundButton.OnClicked = (btn, userdata) =>
{
if (!permissions.HasFlag(ClientPermissions.EndRound)) return false;
@@ -348,7 +348,7 @@ namespace Barotrauma.Networking
}
var msgBox = new GUIMessageBox(pwMsg, "", new string[] { "OK", "Cancel" });
- var passwordBox = new GUITextBox(new Rectangle(0, 40, 150, 25), Alignment.TopLeft, GUI.Style, msgBox.children[0]);
+ var passwordBox = new GUITextBox(new Rectangle(0, 40, 150, 25), Alignment.TopLeft, "", msgBox.children[0]);
passwordBox.UserData = "password";
var okButton = msgBox.Buttons[0];
@@ -1164,13 +1164,12 @@ namespace Barotrauma.Networking
}
}
- public override bool SelectCrewCharacter(GUIComponent component, object obj)
+ public override bool SelectCrewCharacter(Character character, GUIComponent crewFrame)
{
- var characterFrame = component.Parent.Parent.FindChild("selectedcharacter");
-
- Character character = obj as Character;
if (character == null) return false;
+ var characterFrame = crewFrame.FindChild("selectedcharacter");
+
if (character != myCharacter)
{
var client = GameMain.NetworkMember.ConnectedClients.Find(c => c.Character == character);
@@ -1178,19 +1177,19 @@ namespace Barotrauma.Networking
if (HasPermission(ClientPermissions.Ban))
{
- var banButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Ban", Alignment.BottomRight, GUI.Style, characterFrame);
+ var banButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Ban", Alignment.BottomRight, "", characterFrame);
banButton.UserData = character.Name;
banButton.OnClicked += GameMain.NetLobbyScreen.BanPlayer;
}
if (HasPermission(ClientPermissions.Kick))
{
- var kickButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Kick", Alignment.BottomLeft, GUI.Style, characterFrame);
+ var kickButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Kick", Alignment.BottomLeft, "", characterFrame);
kickButton.UserData = character.Name;
kickButton.OnClicked += GameMain.NetLobbyScreen.KickPlayer;
}
else if (Voting.AllowVoteKick)
{
- var kickVoteButton = new GUIButton(new Rectangle(0, 0, 120, 20), "Vote to Kick", Alignment.BottomLeft, GUI.Style, characterFrame);
+ var kickVoteButton = new GUIButton(new Rectangle(0, 0, 120, 20), "Vote to Kick", Alignment.BottomLeft, "", characterFrame);
if (GameMain.NetworkMember.ConnectedClients != null)
{
diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs
index d8c047788..8ab844e9e 100644
--- a/Subsurface/Source/Networking/GameServer.cs
+++ b/Subsurface/Source/Networking/GameServer.cs
@@ -118,11 +118,11 @@ namespace Barotrauma.Networking
//----------------------------------------
- var endRoundButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170, 20, 150, 20), "End round", Alignment.TopLeft, GUI.Style, inGameHUD);
+ var endRoundButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170, 20, 150, 20), "End round", Alignment.TopLeft, "", inGameHUD);
endRoundButton.OnClicked = (btn, userdata) => { EndGame(); return true; };
log = new ServerLog(name);
- showLogButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170 - 170, 20, 150, 20), "Server Log", Alignment.TopLeft, GUI.Style, inGameHUD);
+ showLogButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170 - 170, 20, 150, 20), "Server Log", Alignment.TopLeft, "", inGameHUD);
showLogButton.OnClicked = (GUIButton button, object userData) =>
{
if (log.LogFrame == null)
@@ -137,7 +137,7 @@ namespace Barotrauma.Networking
return true;
};
- GUIButton settingsButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170 - 170 - 170, 20, 150, 20), "Settings", Alignment.TopLeft, GUI.Style, inGameHUD);
+ GUIButton settingsButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170 - 170 - 170, 20, 150, 20), "Settings", Alignment.TopLeft, "", inGameHUD);
settingsButton.OnClicked = ToggleSettingsFrame;
settingsButton.UserData = "settingsButton";
@@ -1669,7 +1669,7 @@ namespace Barotrauma.Networking
if (clientListScrollBar == null)
{
- clientListScrollBar = new GUIScrollBar(new Rectangle(x + width - 10, y, 10, height), GUI.Style, 1.0f);
+ clientListScrollBar = new GUIScrollBar(new Rectangle(x + width - 10, y, 10, height), "", 1.0f);
}
@@ -1756,15 +1756,15 @@ namespace Barotrauma.Networking
clientInfo.ClearChildren();
- var progressBar = new GUIProgressBar(new Rectangle(0, 4, 160, clientInfo.Rect.Height - 8), Color.Green, GUI.Style, 0.0f, Alignment.Left, clientInfo);
+ var progressBar = new GUIProgressBar(new Rectangle(0, 4, 160, clientInfo.Rect.Height - 8), Color.Green, "", 0.0f, Alignment.Left, clientInfo);
progressBar.IsHorizontal = true;
progressBar.ProgressGetter = () => { return transfers.Sum(t => t.Progress) / transfers.Count; };
- var textBlock = new GUITextBlock(new Rectangle(0, 2, 160, 0), "", GUI.Style, Alignment.TopLeft, Alignment.Left | Alignment.CenterY, clientInfo, true, GUI.SmallFont);
+ var textBlock = new GUITextBlock(new Rectangle(0, 2, 160, 0), "", "", Alignment.TopLeft, Alignment.Left | Alignment.CenterY, clientInfo, true, GUI.SmallFont);
textBlock.TextGetter = () =>
{ return MathUtils.GetBytesReadable(transfers.Sum(t => t.SentOffset)) + " / " + MathUtils.GetBytesReadable(transfers.Sum(t => t.Data.Length)); };
- var cancelButton = new GUIButton(new Rectangle(-5, 0, 14, 0), "X", Alignment.Right, GUI.Style, clientInfo);
+ var cancelButton = new GUIButton(new Rectangle(-5, 0, 14, 0), "X", Alignment.Right, "", clientInfo);
cancelButton.OnClicked = (GUIButton button, object userdata) =>
{
transfers.ForEach(t => fileSender.CancelTransfer(t));
@@ -1823,26 +1823,22 @@ namespace Barotrauma.Networking
SaveClientPermissions();
}
- public override bool SelectCrewCharacter(GUIComponent component, object obj)
+ public override bool SelectCrewCharacter(Character character, GUIComponent crewFrame)
{
- base.SelectCrewCharacter(component, obj);
-
- var characterFrame = component.Parent.Parent.FindChild("selectedcharacter");
-
- Character character = obj as Character;
if (character == null) return false;
+ var characterFrame = crewFrame.FindChild("selectedcharacter");
if (character != myCharacter)
{
- var banButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Ban", Alignment.BottomRight, GUI.Style, characterFrame);
+ var banButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Ban", Alignment.BottomRight, "", characterFrame);
banButton.UserData = character.Name;
banButton.OnClicked += GameMain.NetLobbyScreen.BanPlayer;
- var rangebanButton = new GUIButton(new Rectangle(0, -25, 100, 20), "Ban range", Alignment.BottomRight, GUI.Style, characterFrame);
+ var rangebanButton = new GUIButton(new Rectangle(0, -25, 100, 20), "Ban range", Alignment.BottomRight, "", characterFrame);
rangebanButton.UserData = character.Name;
rangebanButton.OnClicked += GameMain.NetLobbyScreen.BanPlayerRange;
- var kickButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Kick", Alignment.BottomLeft, GUI.Style, characterFrame);
+ var kickButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Kick", Alignment.BottomLeft, "", characterFrame);
kickButton.UserData = character.Name;
kickButton.OnClicked += GameMain.NetLobbyScreen.KickPlayer;
}
diff --git a/Subsurface/Source/Networking/GameServerSettings.cs b/Subsurface/Source/Networking/GameServerSettings.cs
index d5d680bba..aa2897fe7 100644
--- a/Subsurface/Source/Networking/GameServerSettings.cs
+++ b/Subsurface/Source/Networking/GameServerSettings.cs
@@ -300,21 +300,21 @@ namespace Barotrauma.Networking
private void CreateSettingsFrame()
{
- settingsFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f);
+ settingsFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f, null);
- GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, 400, 430), null, Alignment.Center, GUI.Style, settingsFrame);
+ GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, 400, 430), null, Alignment.Center, "", settingsFrame);
innerFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
- new GUITextBlock(new Rectangle(0, -5, 0, 20), "Settings", GUI.Style, innerFrame, GUI.LargeFont);
+ new GUITextBlock(new Rectangle(0, -5, 0, 20), "Settings", "", innerFrame, GUI.LargeFont);
string[] tabNames = { "Rounds", "Server", "Banlist", "Whitelist" };
settingsTabs = new GUIFrame[tabNames.Length];
for (int i = 0; i < tabNames.Length; i++)
{
- settingsTabs[i] = new GUIFrame(new Rectangle(0, 15, 0, innerFrame.Rect.Height - 120), null, Alignment.Center, GUI.Style, innerFrame);
+ settingsTabs[i] = new GUIFrame(new Rectangle(0, 15, 0, innerFrame.Rect.Height - 120), null, Alignment.Center, "InnerFrame", innerFrame);
settingsTabs[i].Padding = new Vector4(40.0f, 20.0f, 40.0f, 40.0f);
- var tabButton = new GUIButton(new Rectangle(85 * i, 35, 80, 20), tabNames[i], GUI.Style, innerFrame);
+ var tabButton = new GUIButton(new Rectangle(85 * i, 35, 80, 20), tabNames[i], "", innerFrame);
tabButton.UserData = i;
tabButton.OnClicked = SelectSettingsTab;
}
@@ -323,7 +323,7 @@ namespace Barotrauma.Networking
SelectSettingsTab(null, 0);
- var closeButton = new GUIButton(new Rectangle(10, 10, 100, 20), "Close", Alignment.BottomRight, GUI.Style, innerFrame);
+ var closeButton = new GUIButton(new Rectangle(10, 0, 100, 20), "Close", Alignment.BottomRight, "", innerFrame);
closeButton.OnClicked = ToggleSettingsFrame;
//--------------------------------------------------------------------------------
@@ -334,7 +334,7 @@ namespace Barotrauma.Networking
settingsTabs[0].Padding = new Vector4(40.0f, 5.0f, 40.0f, 40.0f);
- new GUITextBlock(new Rectangle(0, y, 100, 20), "Submarine selection:", GUI.Style, settingsTabs[0]);
+ new GUITextBlock(new Rectangle(0, y, 100, 20), "Submarine selection:", "", settingsTabs[0]);
var selectionFrame = new GUIFrame(new Rectangle(0, y + 20, 300, 20), null, settingsTabs[0]);
for (int i = 0; i < 3; i++)
{
@@ -346,7 +346,7 @@ namespace Barotrauma.Networking
y += 45;
- new GUITextBlock(new Rectangle(0, y, 100, 20), "Mode selection:", GUI.Style, settingsTabs[0]);
+ new GUITextBlock(new Rectangle(0, y, 100, 20), "Mode selection:", "", settingsTabs[0]);
selectionFrame = new GUIFrame(new Rectangle(0, y + 20, 300, 20), null, settingsTabs[0]);
for (int i = 0; i < 3; i++)
{
@@ -374,9 +374,9 @@ namespace Barotrauma.Networking
};
- var votesRequiredText = new GUITextBlock(new Rectangle(20, y + 20, 20, 20), "Votes required: 50 %", GUI.Style, settingsTabs[0], GUI.SmallFont);
+ var votesRequiredText = new GUITextBlock(new Rectangle(20, y + 15, 20, 20), "Votes required: 50 %", "", settingsTabs[0], GUI.SmallFont);
- var votesRequiredSlider = new GUIScrollBar(new Rectangle(150, y + 22, 100, 10), GUI.Style, 0.1f, settingsTabs[0]);
+ var votesRequiredSlider = new GUIScrollBar(new Rectangle(150, y + 22, 100, 15), "", 0.1f, settingsTabs[0]);
votesRequiredSlider.UserData = votesRequiredText;
votesRequiredSlider.Step = 0.2f;
votesRequiredSlider.BarScroll = (EndVoteRequiredRatio - 0.5f) * 2.0f;
@@ -401,9 +401,9 @@ namespace Barotrauma.Networking
};
- var respawnIntervalText = new GUITextBlock(new Rectangle(20, y + 18, 20, 20), "Respawn interval", GUI.Style, settingsTabs[0], GUI.SmallFont);
+ var respawnIntervalText = new GUITextBlock(new Rectangle(20, y + 13, 20, 20), "Respawn interval", "", settingsTabs[0], GUI.SmallFont);
- var respawnIntervalSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 10), GUI.Style, 0.1f, settingsTabs[0]);
+ var respawnIntervalSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 15), "", 0.1f, settingsTabs[0]);
respawnIntervalSlider.UserData = respawnIntervalText;
respawnIntervalSlider.Step = 0.05f;
respawnIntervalSlider.BarScroll = RespawnInterval / 600.0f;
@@ -419,10 +419,10 @@ namespace Barotrauma.Networking
y += 35;
- var minRespawnText = new GUITextBlock(new Rectangle(0, y, 200, 20), "Minimum players to respawn", GUI.Style, settingsTabs[0]);
+ var minRespawnText = new GUITextBlock(new Rectangle(0, y, 200, 20), "Minimum players to respawn", "", settingsTabs[0]);
minRespawnText.ToolTip = "What percentage of players has to be dead/spectating until a respawn shuttle is dispatched";
- var minRespawnSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 10), GUI.Style, 0.1f, settingsTabs[0]);
+ var minRespawnSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 15), "", 0.1f, settingsTabs[0]);
minRespawnSlider.ToolTip = minRespawnText.ToolTip;
minRespawnSlider.UserData = minRespawnText;
minRespawnSlider.Step = 0.1f;
@@ -439,11 +439,11 @@ namespace Barotrauma.Networking
y += 30;
- var respawnDurationText = new GUITextBlock(new Rectangle(0, y, 200, 20), "Duration of respawn transport", GUI.Style, settingsTabs[0]);
+ var respawnDurationText = new GUITextBlock(new Rectangle(0, y, 200, 20), "Duration of respawn transport", "", settingsTabs[0]);
respawnDurationText.ToolTip = "The amount of time respawned players have to navigate the respawn shuttle to the main submarine. " +
"After the duration expires, the shuttle will automatically head back out of the level.";
- var respawnDurationSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 10), GUI.Style, 0.1f, settingsTabs[0]);
+ var respawnDurationSlider = new GUIScrollBar(new Rectangle(150, y + 20, 100, 15), "", 0.1f, settingsTabs[0]);
respawnDurationSlider.ToolTip = minRespawnText.ToolTip;
respawnDurationSlider.UserData = respawnDurationText;
respawnDurationSlider.Step = 0.1f;
@@ -469,9 +469,9 @@ namespace Barotrauma.Networking
y += 35;
- var monsterButton = new GUIButton(new Rectangle(0, y, 130, 20), "Monster Spawns", GUI.Style, settingsTabs[0]);
+ var monsterButton = new GUIButton(new Rectangle(0, y, 130, 20), "Monster Spawns", "", settingsTabs[0]);
monsterButton.Enabled = !GameStarted;
- var monsterFrame = new GUIListBox(new Rectangle(-290, 60, 280, 250), GUI.Style, settingsTabs[0]);
+ var monsterFrame = new GUIListBox(new Rectangle(-290, 60, 280, 250), "", settingsTabs[0]);
monsterFrame.Visible = false;
monsterButton.UserData = monsterFrame;
monsterButton.OnClicked = (button, obj) =>
@@ -491,7 +491,7 @@ namespace Barotrauma.Networking
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 260, 25),
s,
- GUI.Style,
+ "",
Alignment.Left, Alignment.Left, monsterFrame);
textBlock.Padding = new Vector4(35.0f, 3.0f, 0.0f, 0.0f);
textBlock.UserData = monsterFrame;
@@ -512,10 +512,10 @@ namespace Barotrauma.Networking
};
}
- var cargoButton = new GUIButton(new Rectangle(160, y, 130, 20), "Additional Cargo", GUI.Style, settingsTabs[0]);
+ var cargoButton = new GUIButton(new Rectangle(160, y, 130, 20), "Additional Cargo", "", settingsTabs[0]);
cargoButton.Enabled = !GameStarted;
- var cargoFrame = new GUIListBox(new Rectangle(300, 60, 280, 250), GUI.Style, settingsTabs[0]);
+ var cargoFrame = new GUIListBox(new Rectangle(300, 60, 280, 250), "", settingsTabs[0]);
cargoFrame.Visible = false;
cargoButton.UserData = cargoFrame;
cargoButton.OnClicked = (button, obj) =>
@@ -537,17 +537,16 @@ namespace Barotrauma.Networking
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 260, 25),
- pf.Name,
- GUI.Style,
- Alignment.Left, Alignment.Left, cargoFrame);
- textBlock.Padding = new Vector4(30.0f, 3.0f, 0.0f, 0.0f);
+ pf.Name, "",
+ Alignment.Left, Alignment.CenterLeft, cargoFrame, false, GUI.SmallFont);
+ textBlock.Padding = new Vector4(40.0f, 3.0f, 0.0f, 0.0f);
textBlock.UserData = cargoFrame;
textBlock.CanBeFocused = false;
if (pf.sprite != null)
{
float scale = Math.Min(Math.Min(30.0f / pf.sprite.SourceRect.Width, 30.0f / pf.sprite.SourceRect.Height), 1.0f);
- GUIImage img = new GUIImage(new Rectangle(-15-(int)(pf.sprite.SourceRect.Width*scale*0.5f), 12-(int)(pf.sprite.SourceRect.Height*scale*0.5f), 40, 40), pf.sprite, Alignment.Left, textBlock);
+ GUIImage img = new GUIImage(new Rectangle(-20-(int)(pf.sprite.SourceRect.Width*scale*0.5f), 12-(int)(pf.sprite.SourceRect.Height*scale*0.5f), 40, 40), pf.sprite, Alignment.Left, textBlock);
img.Color = pf.SpriteColor;
img.Scale = scale;
}
@@ -555,12 +554,12 @@ namespace Barotrauma.Networking
int cargoVal = 0;
extraCargo.TryGetValue(pf.Name, out cargoVal);
var countText = new GUITextBlock(
- new Rectangle(180, 0, 50, 25),
+ new Rectangle(160, 0, 55, 25),
cargoVal.ToString(),
- GUI.Style,
+ "",
Alignment.Left, Alignment.Center, textBlock);
- var incButton = new GUIButton(new Rectangle(220, 5, 10, 15), ">", GUI.Style, textBlock);
+ var incButton = new GUIButton(new Rectangle(200, 5, 15, 15), ">", "", textBlock);
incButton.UserData = countText;
incButton.OnClicked = (button, obj) =>
{
@@ -578,7 +577,7 @@ namespace Barotrauma.Networking
return true;
};
- var decButton = new GUIButton(new Rectangle(180, 5, 10, 15), "<", GUI.Style, textBlock);
+ var decButton = new GUIButton(new Rectangle(160, 5, 15, 15), "<", "", textBlock);
decButton.UserData = countText;
decButton.OnClicked = (button, obj) =>
{
@@ -608,8 +607,8 @@ namespace Barotrauma.Networking
y = 0;
- var startIntervalText = new GUITextBlock(new Rectangle(-10, y, 100, 20), "Autorestart delay", GUI.Style, settingsTabs[1]);
- var startIntervalSlider = new GUIScrollBar(new Rectangle(10, y + 22, 100, 10), GUI.Style, 0.1f, settingsTabs[1]);
+ var startIntervalText = new GUITextBlock(new Rectangle(-10, y, 100, 20), "Autorestart delay", "", settingsTabs[1]);
+ var startIntervalSlider = new GUIScrollBar(new Rectangle(10, y + 22, 100, 15), "", 0.1f, settingsTabs[1]);
startIntervalSlider.UserData = startIntervalText;
startIntervalSlider.Step = 0.05f;
startIntervalSlider.BarScroll = AutoRestartInterval / 300.0f;
@@ -645,9 +644,9 @@ namespace Barotrauma.Networking
return true;
};
- var kickVotesRequiredText = new GUITextBlock(new Rectangle(20, y + 20, 20, 20), "Votes required: 50 %", GUI.Style, settingsTabs[1], GUI.SmallFont);
+ var kickVotesRequiredText = new GUITextBlock(new Rectangle(20, y + 20, 20, 20), "Votes required: 50 %", "", settingsTabs[1], GUI.SmallFont);
- var kickVoteSlider = new GUIScrollBar(new Rectangle(150, y + 22, 100, 10), GUI.Style, 0.1f, settingsTabs[1]);
+ var kickVoteSlider = new GUIScrollBar(new Rectangle(150, y + 22, 100, 15), "", 0.1f, settingsTabs[1]);
kickVoteSlider.UserData = kickVotesRequiredText;
kickVoteSlider.Step = 0.2f;
kickVoteSlider.BarScroll = (KickVoteRequiredRatio - 0.5f) * 2.0f;
@@ -831,7 +830,7 @@ namespace Barotrauma.Networking
public void ManagePlayersFrame(GUIFrame infoFrame)
{
- GUIListBox cList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, GUI.Style, infoFrame);
+ GUIListBox cList = new GUIListBox(new Rectangle(0, 0, 0, 300), Color.White * 0.7f, "", infoFrame);
cList.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
//crewList.OnSelected = SelectCrewCharacter;
@@ -850,15 +849,15 @@ namespace Barotrauma.Networking
Alignment.Left, Alignment.Left,
null, frame);
- var banButton = new GUIButton(new Rectangle(-110, 0, 100, 20), "Ban", Alignment.Right | Alignment.CenterY, GUI.Style, frame);
+ var banButton = new GUIButton(new Rectangle(-110, 0, 100, 20), "Ban", Alignment.Right | Alignment.CenterY, "", frame);
banButton.UserData = c.name;
banButton.OnClicked = GameMain.NetLobbyScreen.BanPlayer;
- var rangebanButton = new GUIButton(new Rectangle(-220, 0, 100, 20), "Ban range", Alignment.Right | Alignment.CenterY, GUI.Style, frame);
+ var rangebanButton = new GUIButton(new Rectangle(-220, 0, 100, 20), "Ban range", Alignment.Right | Alignment.CenterY, "", frame);
rangebanButton.UserData = c.name;
rangebanButton.OnClicked = GameMain.NetLobbyScreen.BanPlayerRange;
- var kickButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Kick", Alignment.Right | Alignment.CenterY, GUI.Style, frame);
+ var kickButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Kick", Alignment.Right | Alignment.CenterY, "", frame);
kickButton.UserData = c.name;
kickButton.OnClicked = GameMain.NetLobbyScreen.KickPlayer;
diff --git a/Subsurface/Source/Networking/NetworkMember.cs b/Subsurface/Source/Networking/NetworkMember.cs
index 7f992a56b..57697573f 100644
--- a/Subsurface/Source/Networking/NetworkMember.cs
+++ b/Subsurface/Source/Networking/NetworkMember.cs
@@ -151,12 +151,12 @@ namespace Barotrauma.Networking
GameMain.GraphicsWidth - 20 - width,
GameMain.GraphicsHeight - 40 - 25 - height,
width, height),
- Color.White * 0.5f, GUI.Style, inGameHUD);
+ Color.White * 0.5f, "", inGameHUD);
chatBox.Padding = Vector4.Zero;
chatMsgBox = new GUITextBox(
new Rectangle(chatBox.Rect.X, chatBox.Rect.Y + chatBox.Rect.Height + 20, chatBox.Rect.Width, 25),
- Color.White * 0.5f, Color.Black, Alignment.TopLeft, Alignment.Left, GUI.Style, inGameHUD);
+ Color.White * 0.5f, Color.Black, Alignment.TopLeft, Alignment.Left, "", inGameHUD);
chatMsgBox.Font = GUI.SmallFont;
chatMsgBox.Padding = Vector4.Zero;
chatMsgBox.OnEnterPressed = EnterChatMessage;
@@ -363,7 +363,7 @@ namespace Barotrauma.Networking
}
}
- public virtual bool SelectCrewCharacter(GUIComponent component, object obj)
+ public virtual bool SelectCrewCharacter(Character character, GUIComponent crewFrame)
{
return false;
}
diff --git a/Subsurface/Source/Networking/ServerLog.cs b/Subsurface/Source/Networking/ServerLog.cs
index e6f228da9..bcb15c838 100644
--- a/Subsurface/Source/Networking/ServerLog.cs
+++ b/Subsurface/Source/Networking/ServerLog.cs
@@ -59,21 +59,21 @@ namespace Barotrauma.Networking
{
LogFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f);
- GUIFrame innerFrame = new GUIFrame(new Rectangle(0,0,400, 400), null, Alignment.Center, GUI.Style, LogFrame);
+ GUIFrame innerFrame = new GUIFrame(new Rectangle(0,0,400, 400), null, Alignment.Center, "", LogFrame);
innerFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
- new GUITextBlock(new Rectangle(-200,0,100,15), "Filter", GUI.Style, Alignment.TopRight, Alignment.TopRight, innerFrame, false, GUI.SmallFont);
+ new GUITextBlock(new Rectangle(-200,0,100,15), "Filter", "", Alignment.TopRight, Alignment.TopRight, innerFrame, false, GUI.SmallFont);
- GUITextBox searchBox = new GUITextBox(new Rectangle(-20,0,180,15), Alignment.TopRight, GUI.Style, innerFrame);
+ GUITextBox searchBox = new GUITextBox(new Rectangle(-20,0,180,15), Alignment.TopRight, "", innerFrame);
searchBox.Font = GUI.SmallFont;
searchBox.OnTextChanged = FilterMessages;
GUIComponent.KeyboardDispatcher.Subscriber = searchBox;
- var clearButton = new GUIButton(new Rectangle(0,0,15,15), "x", Alignment.TopRight, GUI.Style, innerFrame);
+ var clearButton = new GUIButton(new Rectangle(0,0,15,15), "x", Alignment.TopRight, "", innerFrame);
clearButton.OnClicked = ClearFilter;
clearButton.UserData = searchBox;
- listBox = new GUIListBox(new Rectangle(0,20,0,335), GUI.Style, innerFrame);
+ listBox = new GUIListBox(new Rectangle(0,20,0,335), "", innerFrame);
var currLines = lines.ToList();
@@ -86,7 +86,7 @@ namespace Barotrauma.Networking
if (listBox.BarScroll==0.0f || listBox.BarScroll==1.0f) listBox.BarScroll = 1.0f;
- GUIButton closeButton = new GUIButton(new Rectangle(0,0,100, 15), "Close", Alignment.BottomRight, GUI.Style, innerFrame);
+ GUIButton closeButton = new GUIButton(new Rectangle(0,0,100, 15), "Close", Alignment.BottomRight, "", innerFrame);
closeButton.OnClicked = (GUIButton button, object userData) =>
{
LogFrame = null;
@@ -98,7 +98,7 @@ namespace Barotrauma.Networking
{
float prevSize = listBox.BarSize;
- var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), line.Text, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, listBox, true, GUI.SmallFont);
+ var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), line.Text, "", Alignment.TopLeft, Alignment.TopLeft, listBox, true, GUI.SmallFont);
textBlock.Rect = new Rectangle(textBlock.Rect.X, textBlock.Rect.Y, textBlock.Rect.Width, Math.Max(13, textBlock.Rect.Height));
//listBox.AddChild(textBlock);
diff --git a/Subsurface/Source/Networking/Voting.cs b/Subsurface/Source/Networking/Voting.cs
index 99b32c296..77681c37d 100644
--- a/Subsurface/Source/Networking/Voting.cs
+++ b/Subsurface/Source/Networking/Voting.cs
@@ -85,7 +85,7 @@ namespace Barotrauma
GUITextBlock voteText = comp.FindChild("votes") as GUITextBlock;
if (voteText == null)
{
- voteText = new GUITextBlock(new Rectangle(0, 0, 30, 0), "", GUI.Style, Alignment.Right, Alignment.Right, comp);
+ voteText = new GUITextBlock(new Rectangle(0, 0, 30, 0), "", "", Alignment.Right, Alignment.Right, comp);
voteText.UserData = "votes";
}
diff --git a/Subsurface/Source/Networking/WhiteList.cs b/Subsurface/Source/Networking/WhiteList.cs
index cc419eb70..a55097d7e 100644
--- a/Subsurface/Source/Networking/WhiteList.cs
+++ b/Subsurface/Source/Networking/WhiteList.cs
@@ -154,18 +154,18 @@ namespace Barotrauma.Networking
return true;
};
- new GUITextBlock(new Rectangle(0, -25, 90, 20), "Name:", GUI.Style, Alignment.BottomLeft, Alignment.TopLeft, parent, false, GUI.Font);
- nameBox = new GUITextBox(new Rectangle(100, -25, 170, 20), Alignment.BottomLeft, GUI.Style, parent);
+ new GUITextBlock(new Rectangle(0, -35, 90, 20), "Name:", "", Alignment.BottomLeft, Alignment.CenterLeft, parent, false, GUI.Font);
+ nameBox = new GUITextBox(new Rectangle(100, -35, 170, 20), Alignment.BottomLeft, "", parent);
nameBox.Font = GUI.Font;
- new GUITextBlock(new Rectangle(0, 5, 90, 20), "IP Address:", GUI.Style, Alignment.BottomLeft, Alignment.TopLeft, parent, false, GUI.Font);
- ipBox = new GUITextBox(new Rectangle(100, 5, 170, 20), Alignment.BottomLeft, GUI.Style, parent);
+ new GUITextBlock(new Rectangle(0, 0, 90, 20), "IP Address:", "", Alignment.BottomLeft, Alignment.CenterLeft, parent, false, GUI.Font);
+ ipBox = new GUITextBox(new Rectangle(100, 0, 170, 20), Alignment.BottomLeft, "", parent);
ipBox.Font = GUI.Font;
- var addnewButton = new GUIButton(new Rectangle(0, 45, 150, 20), "Add to whitelist", Alignment.BottomLeft, GUI.Style, parent);
+ var addnewButton = new GUIButton(new Rectangle(0, 35, 150, 20), "Add to whitelist", Alignment.BottomLeft, "", parent);
addnewButton.OnClicked = AddToWhiteList;
- whitelistFrame = new GUIListBox(new Rectangle(0, 30, 0, parent.Rect.Height-100), GUI.Style, parent);
+ whitelistFrame = new GUIListBox(new Rectangle(0, 30, 0, parent.Rect.Height-110), "", parent);
foreach (WhiteListedPlayer wlp in whitelistedPlayers)
{
@@ -174,12 +174,12 @@ namespace Barotrauma.Networking
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
blockText,
- GUI.Style,
+ "",
Alignment.Left, Alignment.Left, whitelistFrame);
textBlock.Padding = new Vector4(10.0f, 10.0f, 0.0f, 0.0f);
textBlock.UserData = wlp;
- var removeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Remove", Alignment.Right | Alignment.CenterY, GUI.Style, textBlock);
+ var removeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Remove", Alignment.Right | Alignment.CenterY, "", textBlock);
removeButton.UserData = wlp;
removeButton.OnClicked = RemoveFromWhiteList;
}
diff --git a/Subsurface/Source/Screens/EditCharacterScreen.cs b/Subsurface/Source/Screens/EditCharacterScreen.cs
index 64e309ed3..d6a10e1ed 100644
--- a/Subsurface/Source/Screens/EditCharacterScreen.cs
+++ b/Subsurface/Source/Screens/EditCharacterScreen.cs
@@ -43,18 +43,18 @@ namespace Barotrauma
cam = new Camera();
- GUIpanel = new GUIFrame(new Rectangle(0, 0, 300, GameMain.GraphicsHeight), GUI.Style);
+ GUIpanel = new GUIFrame(new Rectangle(0, 0, 300, GameMain.GraphicsHeight), "");
GUIpanel.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
- physicsButton = new GUIButton(new Rectangle(0, 50, 200, 25), "Physics", Alignment.Left, GUI.Style, GUIpanel);
+ physicsButton = new GUIButton(new Rectangle(0, 50, 200, 25), "Physics", Alignment.Left, "", GUIpanel);
physicsButton.OnClicked += TogglePhysics;
- new GUITextBlock(new Rectangle(0, 80, 0, 25), "Limbs:", GUI.Style, GUIpanel);
- limbList = new GUIListBox(new Rectangle(0, 110, 0, 250), Color.White * 0.7f, GUI.Style, GUIpanel);
+ new GUITextBlock(new Rectangle(0, 80, 0, 25), "Limbs:", "", GUIpanel);
+ limbList = new GUIListBox(new Rectangle(0, 110, 0, 250), Color.White * 0.7f, "", GUIpanel);
limbList.OnSelected = SelectLimb;
- new GUITextBlock(new Rectangle(0, 360, 0, 25), "Joints:", GUI.Style, GUIpanel);
- jointList = new GUIListBox(new Rectangle(0, 390, 0, 250), Color.White * 0.7f, GUI.Style, GUIpanel);
+ new GUITextBlock(new Rectangle(0, 360, 0, 25), "Joints:", "", GUIpanel);
+ jointList = new GUIListBox(new Rectangle(0, 390, 0, 250), Color.White * 0.7f, "", GUIpanel);
while (Character.CharacterList.Count > 1)
{
diff --git a/Subsurface/Source/Screens/EditMapScreen.cs b/Subsurface/Source/Screens/EditMapScreen.cs
index bf6857632..22524bbb2 100644
--- a/Subsurface/Source/Screens/EditMapScreen.cs
+++ b/Subsurface/Source/Screens/EditMapScreen.cs
@@ -31,7 +31,7 @@ namespace Barotrauma
const int PreviouslyUsedCount = 10;
private GUIListBox previouslyUsedList;
- GUIDropDown linkedSubBox;
+ private GUIDropDown linkedSubBox;
//a Character used for picking up and manipulating items
private Character dummyCharacter;
@@ -126,37 +126,46 @@ namespace Barotrauma
selectedTab = -1;
- topPanel = new GUIFrame(new Rectangle(0, 0, 0, 31), GUI.Style);
+ topPanel = new GUIFrame(new Rectangle(0, 0, 0, 35), "GUIFrameTop");
topPanel.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
- hullVolumeFrame = new GUIFrame(new Rectangle(145, 26, 280, 70), GUI.Style, topPanel);
+ hullVolumeFrame = new GUIFrame(new Rectangle(145, 26, 280, 70), "", topPanel);
hullVolumeFrame.Visible = false;
hullVolumeFrame.Padding = new Vector4(3.0f, 3.0f, 3.0f, 3.0f);
- GUITextBlock totalHullVolume = new GUITextBlock(new Rectangle(0, 0, 0, 20), "", GUI.Style, hullVolumeFrame, GUI.SmallFont);
+ GUITextBlock totalHullVolume = new GUITextBlock(new Rectangle(0, 0, 0, 20), "", "", hullVolumeFrame, GUI.SmallFont);
totalHullVolume.TextGetter = GetTotalHullVolume;
- GUITextBlock selectedHullVolume = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", GUI.Style, hullVolumeFrame, GUI.SmallFont);
+ GUITextBlock selectedHullVolume = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", "", hullVolumeFrame, GUI.SmallFont);
selectedHullVolume.TextGetter = GetSelectedHullVolume;
-
- var button = new GUIButton(new Rectangle(0, 0, 70, 20), "Open...", GUI.Style, topPanel);
- button.OnClicked = CreateLoadScreen;
-
- button = new GUIButton(new Rectangle(80,0,70,20), "Save", GUI.Style, topPanel);
+
+ var button = new GUIButton(new Rectangle(0, 0, 70, 20), "Open...", "", topPanel);
button.OnClicked = (GUIButton btn, object data) =>
{
+ saveFrame = null;
+ selectedTab = -1;
+ CreateLoadScreen();
+
+ return true;
+ };
+
+ button = new GUIButton(new Rectangle(80,0,70,20), "Save", "", topPanel);
+ button.OnClicked = (GUIButton btn, object data) =>
+ {
+ loadFrame = null;
+ selectedTab = -1;
CreateSaveScreen();
return true;
};
- var nameLabel = new GUITextBlock(new Rectangle(170, -4, 150, 20), "", GUI.Style, topPanel, GUI.LargeFont);
+ var nameLabel = new GUITextBlock(new Rectangle(170, 0, 150, 20), "", "", Alignment.TopLeft, Alignment.CenterLeft, topPanel, false, GUI.LargeFont);
nameLabel.TextGetter = GetSubName;
- linkedSubBox = new GUIDropDown(new Rectangle(750,0,200,20), "Add submarine", GUI.Style, topPanel);
- linkedSubBox.ToolTip =
- "Places another submarine into the current submarine file. "+
- "Can be used for adding things such as smaller vessels, "+
+ linkedSubBox = new GUIDropDown(new Rectangle(750, 0, 200, 20), "Add submarine", "", topPanel);
+ linkedSubBox.ToolTip =
+ "Places another submarine into the current submarine file. " +
+ "Can be used for adding things such as smaller vessels, " +
"escape pods or detachable sections into the main submarine.";
foreach (Submarine sub in Submarine.SavedSubmarines)
@@ -164,64 +173,58 @@ namespace Barotrauma
linkedSubBox.AddItem(sub.Name, sub);
}
linkedSubBox.OnSelected += SelectLinkedSub;
-
- leftPanel = new GUIFrame(new Rectangle(0, 30, 150, GameMain.GraphicsHeight-30), GUI.Style);
+
+ leftPanel = new GUIFrame(new Rectangle(0, 0, 150, GameMain.GraphicsHeight), "GUIFrameLeft");
leftPanel.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
-
- GUITextBlock itemCount = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", GUI.Style, leftPanel);
+
+ GUITextBlock itemCount = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", "", leftPanel);
itemCount.TextGetter = GetItemCount;
- GUITextBlock structureCount = new GUITextBlock(new Rectangle(0, 50, 0, 20), "", GUI.Style, leftPanel);
+ GUITextBlock structureCount = new GUITextBlock(new Rectangle(0, 50, 0, 20), "", "", leftPanel);
structureCount.TextGetter = GetStructureCount;
- GUItabs = new GUIComponent[Enum.GetValues(typeof(MapEntityCategory)).Length];
+ GUItabs = new GUIComponent[Enum.GetValues(typeof(MapEntityCategory)).Length];
int width = 400, height = 400;
int y = 90;
int i = 0;
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
{
- var catButton = new GUIButton(new Rectangle(0, y, 0, 20), category.ToString(), Alignment.Left, GUI.Style, leftPanel);
+ var catButton = new GUIButton(new Rectangle(0, y, 0, 20), category.ToString(), Alignment.Left, "", leftPanel);
catButton.UserData = i;
catButton.OnClicked = SelectTab;
y+=25;
- GUItabs[i] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style);
- GUItabs[i].Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
+ GUItabs[i] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "");
+ GUItabs[i].Padding = new Vector4(10.0f, 30.0f, 10.0f, 10.0f);
- new GUITextBlock(new Rectangle(-200, 0, 100, 15), "Filter", GUI.Style, Alignment.TopRight, Alignment.TopRight, GUItabs[i], false, GUI.SmallFont);
+ new GUITextBlock(new Rectangle(-200, 0, 100, 15), "Filter", "", Alignment.TopRight, Alignment.CenterRight, GUItabs[i], false, GUI.SmallFont);
- GUITextBox searchBox = new GUITextBox(new Rectangle(-20, 0, 180, 15), Alignment.TopRight, GUI.Style, GUItabs[i]);
+ GUITextBox searchBox = new GUITextBox(new Rectangle(-20, 0, 180, 15), null,null, Alignment.TopRight, Alignment.CenterLeft, "", GUItabs[i]);
searchBox.Font = GUI.SmallFont;
searchBox.OnTextChanged = FilterMessages;
- var clearButton = new GUIButton(new Rectangle(0, 0, 15, 15), "x", Alignment.TopRight, GUI.Style, GUItabs[i]);
+ var clearButton = new GUIButton(new Rectangle(0, 0, 15, 15), "x", Alignment.TopRight, "", GUItabs[i]);
clearButton.OnClicked = ClearFilter;
clearButton.UserData = searchBox;
- GUIListBox itemList = new GUIListBox(new Rectangle(0, 20, 0, 0), Color.White * 0.7f, GUI.Style, GUItabs[i]);
+ GUIListBox itemList = new GUIListBox(new Rectangle(0, 20, 0, 0), Color.White * 0.7f, "", GUItabs[i]);
itemList.OnSelected = SelectPrefab;
itemList.CheckSelected = MapEntityPrefab.GetSelected;
foreach (MapEntityPrefab ep in MapEntityPrefab.list)
{
if (!ep.Category.HasFlag(category)) continue;
-
- Color color = ((itemList.CountChildren % 2) == 0) ? Color.Transparent : Color.White * 0.1f;
-
- GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 50), Color.Transparent, null, itemList);
+
+ GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 50), Color.Transparent, "ListBoxElement", itemList);
frame.UserData = ep;
frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
- frame.Color = color;
- frame.HoverColor = Color.Gold * 0.2f;
- frame.SelectedColor = Color.Gold * 0.5f;
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(40, 0, 0, 25),
- ep.Name,
- Color.Transparent, Color.White,
- Alignment.Left, Alignment.Left,
- null, frame);
+ ep.Name, "",
+ Alignment.Top, Alignment.CenterLeft,
+ frame);
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
if (!string.IsNullOrWhiteSpace(ep.Description))
@@ -231,7 +234,7 @@ namespace Barotrauma
if (ep.sprite != null)
{
- GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), ep.sprite, Alignment.Left, frame);
+ GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), ep.sprite, Alignment.CenterLeft, frame);
img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f);
img.Color = ep.SpriteColor;
}
@@ -242,24 +245,24 @@ namespace Barotrauma
i++;
}
- y+=50;
- button = new GUIButton(new Rectangle(0, y, 0, 20), "Character mode", Alignment.Left, GUI.Style, leftPanel);
+ y += 10;
+ button = new GUIButton(new Rectangle(0, y, 0, 20), "Character mode", Alignment.Left, "", leftPanel);
button.ToolTip = "Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.";
button.OnClicked = ToggleCharacterMode;
- y += 35;
- button = new GUIButton(new Rectangle(0, y, 0, 20), "Wiring mode", Alignment.Left, GUI.Style, leftPanel);
+ y += 25;
+ button = new GUIButton(new Rectangle(0, y, 0, 20), "Wiring mode", Alignment.Left, "", leftPanel);
//button.ToolTip = "Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.";
button.OnClicked = ToggleWiringMode;
-
- y+=50;
- button = new GUIButton(new Rectangle(0, y, 0, 20), "Generate waypoints", Alignment.Left, GUI.Style, leftPanel);
+
+ y += 35;
+ button = new GUIButton(new Rectangle(0, y, 0, 20), "Generate waypoints", Alignment.Left, "", leftPanel);
button.ToolTip = "AI controlled crew members require waypoints to navigate around the sub.";
button.OnClicked = GenerateWaypoints;
-
- y+=50;
- new GUITextBlock(new Rectangle(0, y, 0, 20), "Show:", GUI.Style, leftPanel);
+ y += 30;
+
+ new GUITextBlock(new Rectangle(0, y, 0, 20), "Show:", "", leftPanel);
var tickBox = new GUITickBox(new Rectangle(0,y+20,20,20), "Waypoints", Alignment.TopLeft, leftPanel);
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowWayPoints = !WayPoint.ShowWayPoints; return true; };
@@ -281,9 +284,9 @@ namespace Barotrauma
if (y < GameMain.GraphicsHeight - 100)
{
- new GUITextBlock(new Rectangle(0, y, 0, 15), "Previously used:", GUI.Style, leftPanel);
+ new GUITextBlock(new Rectangle(0, y, 0, 15), "Previously used:", "", leftPanel);
- previouslyUsedList = new GUIListBox(new Rectangle(0, y + 15, 0, Math.Min(GameMain.GraphicsHeight - y - 40, 150)), GUI.Style, leftPanel);
+ previouslyUsedList = new GUIListBox(new Rectangle(0, y + 20, 0, Math.Min(GameMain.GraphicsHeight - y - 80, 150)), "", leftPanel);
previouslyUsedList.OnSelected = SelectPrefab;
}
@@ -425,33 +428,33 @@ namespace Barotrauma
int y = 0;
- saveFrame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style, null);
+ saveFrame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "", null);
saveFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
- new GUITextBlock(new Rectangle(0,0,200,30), "Save submarine", GUI.Style, saveFrame, GUI.LargeFont);
+ new GUITextBlock(new Rectangle(0,0,200,30), "Save submarine", "", saveFrame, GUI.LargeFont);
y += 30;
- new GUITextBlock(new Rectangle(0,y,150,20), "Name:", GUI.Style, saveFrame);
+ new GUITextBlock(new Rectangle(0,y,150,20), "Name:", "", saveFrame);
y += 20;
- nameBox = new GUITextBox(new Rectangle(5, y, 250, 20), GUI.Style, saveFrame);
+ nameBox = new GUITextBox(new Rectangle(5, y, 250, 20), "", saveFrame);
nameBox.OnEnterPressed = ChangeSubName;
nameBox.Text = GetSubName();
y += 30;
- new GUITextBlock(new Rectangle(0, y, 150, 20), "Description:", GUI.Style, saveFrame);
+ new GUITextBlock(new Rectangle(0, y, 150, 20), "Description:", "", saveFrame);
y += 20;
var descriptionBox = new GUITextBox(new Rectangle(5, y, 0, 100), null, null, Alignment.TopLeft,
- Alignment.TopLeft, GUI.Style, saveFrame);
+ Alignment.TopLeft, "", saveFrame);
descriptionBox.Wrap = true;
descriptionBox.Text = Submarine.MainSub == null ? "" : Submarine.MainSub.Description;
descriptionBox.OnTextChanged = ChangeSubDescription;
y += descriptionBox.Rect.Height + 15;
- new GUITextBlock(new Rectangle(0, y, 150, 20), "Settings:", GUI.Style, saveFrame);
+ new GUITextBlock(new Rectangle(0, y, 150, 20), "Settings:", "", saveFrame);
y += 20;
@@ -491,10 +494,10 @@ namespace Barotrauma
}
}
- var saveButton = new GUIButton(new Rectangle(-90, 0, 80, 20), "Save", Alignment.Right | Alignment.Bottom, GUI.Style, saveFrame);
+ var saveButton = new GUIButton(new Rectangle(-90, 0, 80, 20), "Save", Alignment.Right | Alignment.Bottom, "", saveFrame);
saveButton.OnClicked = SaveSub;
- var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Cancel", Alignment.Right | Alignment.Bottom, GUI.Style, saveFrame);
+ var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Cancel", Alignment.Right | Alignment.Bottom, "", saveFrame);
cancelButton.OnClicked = (GUIButton btn, object userdata) =>
{
saveFrame = null;
@@ -503,7 +506,7 @@ namespace Barotrauma
}
- private bool CreateLoadScreen(GUIButton button, object obj)
+ private bool CreateLoadScreen()
{
if (characterMode) ToggleCharacterMode();
if (wiringMode) ToggleWiringMode();
@@ -511,10 +514,10 @@ namespace Barotrauma
Submarine.RefreshSavedSubs();
int width = 300, height = 400;
- loadFrame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style, null);
+ loadFrame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "", null);
loadFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
- var subList = new GUIListBox(new Rectangle(0, 0, 0, height - 50), Color.White, GUI.Style, loadFrame);
+ var subList = new GUIListBox(new Rectangle(0, 0, 0, height - 50), Color.White, "", loadFrame);
subList.OnSelected = (GUIComponent selected, object userData) =>
{
var deleteBtn = loadFrame.FindChild("delete") as GUIButton;
@@ -528,7 +531,7 @@ namespace Barotrauma
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
ToolBox.LimitString(sub.Name, GUI.Font, subList.Rect.Width - 80),
- GUI.Style,
+ "",
Alignment.Left, Alignment.CenterY | Alignment.Left, subList);
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
textBlock.UserData = sub;
@@ -536,13 +539,13 @@ namespace Barotrauma
if (sub.HasTag(SubmarineTag.Shuttle))
{
- var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", GUI.Style, Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
+ var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
shuttleText.TextColor = textBlock.TextColor * 0.8f;
shuttleText.ToolTip = textBlock.ToolTip;
}
}
- var deleteButton = new GUIButton(new Rectangle(0, 0, 70, 20), "Delete", Alignment.BottomLeft, GUI.Style, loadFrame);
+ var deleteButton = new GUIButton(new Rectangle(0, 0, 70, 20), "Delete", Alignment.BottomLeft, "", loadFrame);
deleteButton.Enabled = false;
deleteButton.UserData = "delete";
deleteButton.OnClicked = (btn, userdata) =>
@@ -562,15 +565,15 @@ namespace Barotrauma
deleteButton.Enabled = false;
- CreateLoadScreen(null, null);
+ CreateLoadScreen();
return true;
};
- var loadButton = new GUIButton(new Rectangle(-90, 0, 80, 20), "Load", Alignment.Right | Alignment.Bottom, GUI.Style, loadFrame);
+ var loadButton = new GUIButton(new Rectangle(-90, 0, 80, 20), "Load", Alignment.Right | Alignment.Bottom, "", loadFrame);
loadButton.OnClicked = LoadSub;
- var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Cancel", Alignment.Right | Alignment.Bottom, GUI.Style, loadFrame);
+ var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Cancel", Alignment.Right | Alignment.Bottom, "", loadFrame);
cancelButton.OnClicked = (GUIButton btn, object userdata) =>
{
loadFrame = null;
@@ -605,6 +608,9 @@ namespace Barotrauma
if (characterMode) ToggleCharacterMode();
if (wiringMode) ToggleWiringMode();
+ saveFrame = null;
+ loadFrame = null;
+
selectedTab = (int)obj;
var searchBox = GUItabs[selectedTab].GetChild();
@@ -738,10 +744,10 @@ namespace Barotrauma
private GUIFrame CreateWiringPanel()
{
- GUIFrame frame = new GUIFrame(new Rectangle(0,0,65,300), null, Alignment.Right | Alignment.CenterY, GUI.Style);
+ GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 65, 300), null, Alignment.Right | Alignment.CenterY, "GUIFrameRight");
frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
- GUIListBox listBox = new GUIListBox(Rectangle.Empty, GUI.Style, frame);
+ GUIListBox listBox = new GUIListBox(Rectangle.Empty, "", frame);
listBox.OnSelected = SelectWire;
foreach (MapEntityPrefab ep in MapEntityPrefab.list)
@@ -878,9 +884,10 @@ namespace Barotrauma
string name = ToolBox.LimitString(mapEntityPrefab.Name,15);
var textBlock = new GUITextBlock(
- new Rectangle(0,0,0,10),
- ToolBox.LimitString(name, GUI.SmallFont, previouslyUsedList.Rect.Width),
- GUI.Style, previouslyUsedList, GUI.SmallFont);
+ new Rectangle(0,0,0,15),
+ ToolBox.LimitString(name, GUI.SmallFont, previouslyUsedList.Rect.Width),
+ "", Alignment.TopLeft, Alignment.CenterLeft,
+ previouslyUsedList, false, GUI.SmallFont);
textBlock.UserData = mapEntityPrefab;
diff --git a/Subsurface/Source/Screens/LobbyScreen.cs b/Subsurface/Source/Screens/LobbyScreen.cs
index 76ac9323f..5e6e29208 100644
--- a/Subsurface/Source/Screens/LobbyScreen.cs
+++ b/Subsurface/Source/Screens/LobbyScreen.cs
@@ -65,23 +65,23 @@ namespace Barotrauma
GameMain.GraphicsWidth - 80,
100);
- topPanel = new GUIFrame(panelRect, GUI.Style);
+ topPanel = new GUIFrame(panelRect, "");
topPanel.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
- GUITextBlock moneyText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "", GUI.Style,
+ GUITextBlock moneyText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "", "",
Alignment.BottomLeft, Alignment.BottomLeft, topPanel);
moneyText.TextGetter = GetMoney;
- GUIButton button = new GUIButton(new Rectangle(-240, 0, 100, 30), "Map", null, Alignment.BottomRight, GUI.Style, topPanel);
+ GUIButton button = new GUIButton(new Rectangle(-240, 0, 100, 30), "Map", null, Alignment.BottomRight, "", topPanel);
button.UserData = PanelTab.Map;
button.OnClicked = SelectRightPanel;
SelectRightPanel(button, button.UserData);
- button = new GUIButton(new Rectangle(-120, 0, 100, 30), "Crew", null, Alignment.BottomRight, GUI.Style, topPanel);
+ button = new GUIButton(new Rectangle(-120, 0, 100, 30), "Crew", null, Alignment.BottomRight, "", topPanel);
button.UserData = PanelTab.Crew;
button.OnClicked = SelectRightPanel;
- button = new GUIButton(new Rectangle(0, 0, 100, 30), "Store", null, Alignment.BottomRight, GUI.Style, topPanel);
+ button = new GUIButton(new Rectangle(0, 0, 100, 30), "Store", null, Alignment.BottomRight, "", topPanel);
button.UserData = PanelTab.Store;
button.OnClicked = SelectRightPanel;
@@ -96,44 +96,44 @@ namespace Barotrauma
bottomPanel = new GUIFrame[4];
- bottomPanel[(int)PanelTab.Crew] = new GUIFrame(panelRect, GUI.Style);
+ bottomPanel[(int)PanelTab.Crew] = new GUIFrame(panelRect, "");
bottomPanel[(int)PanelTab.Crew].Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
- //new GUITextBlock(new Rectangle(0, 0, 200, 25), "Crew:", Color.Transparent, Color.White, Alignment.Left, GUI.Style, bottomPanel[(int)PanelTab.Crew]);
+ //new GUITextBlock(new Rectangle(0, 0, 200, 25), "Crew:", Color.Transparent, Color.White, Alignment.Left, "", bottomPanel[(int)PanelTab.Crew]);
int crewColumnWidth = Math.Min(300, (panelRect.Width - 40) / 2);
- new GUITextBlock(new Rectangle(0, 0, 100, 20), "Crew:", GUI.Style, bottomPanel[(int)PanelTab.Crew], GUI.LargeFont);
- characterList = new GUIListBox(new Rectangle(0, 40, crewColumnWidth, 0), GUI.Style, bottomPanel[(int)PanelTab.Crew]);
+ new GUITextBlock(new Rectangle(0, 0, 100, 20), "Crew:", "", bottomPanel[(int)PanelTab.Crew], GUI.LargeFont);
+ characterList = new GUIListBox(new Rectangle(0, 40, crewColumnWidth, 0), "", bottomPanel[(int)PanelTab.Crew]);
characterList.OnSelected = SelectCharacter;
//---------------------------------------
- bottomPanel[(int)PanelTab.Map] = new GUIFrame(panelRect, GUI.Style);
+ bottomPanel[(int)PanelTab.Map] = new GUIFrame(panelRect, "");
bottomPanel[(int)PanelTab.Map].Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
startButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start",
- Alignment.BottomRight, GUI.Style, bottomPanel[(int)PanelTab.Map]);
+ Alignment.BottomRight, "", bottomPanel[(int)PanelTab.Map]);
startButton.OnClicked = StartShift;
startButton.Enabled = false;
//---------------------------------------
- bottomPanel[(int)PanelTab.Store] = new GUIFrame(panelRect, GUI.Style);
+ bottomPanel[(int)PanelTab.Store] = new GUIFrame(panelRect, "");
bottomPanel[(int)PanelTab.Store].Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
int sellColumnWidth = (panelRect.Width - 40) / 2 - 20;
- selectedItemList = new GUIListBox(new Rectangle(0, 30, sellColumnWidth, 400), Color.White * 0.7f, GUI.Style, bottomPanel[(int)PanelTab.Store]);
+ selectedItemList = new GUIListBox(new Rectangle(0, 30, sellColumnWidth, 400), Color.White * 0.7f, "", bottomPanel[(int)PanelTab.Store]);
selectedItemList.OnSelected = DeselectItem;
- var costText = new GUITextBlock(new Rectangle(0, 0, 100, 25), "Cost: ", GUI.Style, Alignment.BottomLeft, Alignment.TopLeft, bottomPanel[(int)PanelTab.Store]);
+ var costText = new GUITextBlock(new Rectangle(0, 0, 100, 25), "Cost: ", "", Alignment.BottomLeft, Alignment.TopLeft, bottomPanel[(int)PanelTab.Store]);
costText.TextGetter = CostTextGetter;
- buyButton = new GUIButton(new Rectangle(selectedItemList.Rect.Width - 100, 0, 100, 25), "Buy", Alignment.Bottom, GUI.Style, bottomPanel[(int)PanelTab.Store]);
+ buyButton = new GUIButton(new Rectangle(selectedItemList.Rect.Width - 100, 0, 100, 25), "Buy", Alignment.Bottom, "", bottomPanel[(int)PanelTab.Store]);
buyButton.OnClicked = BuyItems;
- storeItemList = new GUIListBox(new Rectangle(0, 30, sellColumnWidth, 400), Color.White * 0.7f, Alignment.TopRight, GUI.Style, bottomPanel[(int)PanelTab.Store]);
+ storeItemList = new GUIListBox(new Rectangle(0, 30, sellColumnWidth, 400), Color.White * 0.7f, Alignment.TopRight, "", bottomPanel[(int)PanelTab.Store]);
storeItemList.OnSelected = SelectItem;
int x = selectedItemList.Rect.Width + 40;
@@ -142,7 +142,7 @@ namespace Barotrauma
var items = MapEntityPrefab.list.FindAll(ep => ep.Price>0.0f && ep.Category.HasFlag(category));
if (!items.Any()) continue;
- var categoryButton = new GUIButton(new Rectangle(x, 0, 100, 20), category.ToString(), GUI.Style, bottomPanel[(int)PanelTab.Store]);
+ var categoryButton = new GUIButton(new Rectangle(x, 0, 100, 20), category.ToString(), "", bottomPanel[(int)PanelTab.Store]);
categoryButton.UserData = category;
categoryButton.OnClicked = SelectItemCategory;
@@ -169,15 +169,15 @@ namespace Barotrauma
topPanel.UserData = location;
var locationTitle = new GUITextBlock(new Rectangle(0, 0, 200, 25),
- "Location: "+location.Name, Color.Transparent, Color.White, Alignment.TopLeft, GUI.Style, topPanel);
+ "Location: "+location.Name, Color.Transparent, Color.White, Alignment.TopLeft, "", topPanel);
locationTitle.UserData = "locationtitle";
locationTitle.Font = GUI.LargeFont;
if (hireList == null)
{
- hireList = new GUIListBox(new Rectangle(0, 40, 300, 0), GUI.Style, Alignment.Right, bottomPanel[(int)PanelTab.Crew]);
- new GUITextBlock(new Rectangle(0, 0, 300, 20), "Hire:", GUI.Style, Alignment.Right, Alignment.Left, bottomPanel[(int)PanelTab.Crew], false, GUI.LargeFont);
+ hireList = new GUIListBox(new Rectangle(0, 40, 300, 0), "", Alignment.Right, bottomPanel[(int)PanelTab.Crew]);
+ new GUITextBlock(new Rectangle(0, 0, 300, 20), "Hire:", "", Alignment.Right, Alignment.Left, bottomPanel[(int)PanelTab.Crew], false, GUI.LargeFont);
hireList.OnSelected = SelectCharacter;
}
@@ -187,7 +187,7 @@ namespace Barotrauma
hireList.ClearChildren();
hireList.Enabled = false;
- new GUITextBlock(new Rectangle(0, 0, 0, 0), "No-one available for hire", Color.Transparent, Color.LightGray, Alignment.Center, Alignment.Center, GUI.Style, hireList);
+ new GUITextBlock(new Rectangle(0, 0, 0, 0), "No-one available for hire", Color.Transparent, Color.LightGray, Alignment.Center, Alignment.Center, "", hireList);
return;
}
@@ -202,7 +202,7 @@ namespace Barotrauma
new Rectangle(0, 0, 0, 25),
c.Salary.ToString(),
null, null,
- Alignment.TopRight, GUI.Style, frame);
+ Alignment.TopRight, "", frame);
}
}
@@ -226,17 +226,17 @@ namespace Barotrauma
if (location == null) return;
- new GUITextBlock(new Rectangle(0, 0, 250, 0), location.Name, GUI.Style, Alignment.TopLeft, Alignment.TopCenter, locationPanel, true, GUI.LargeFont);
+ new GUITextBlock(new Rectangle(0, 0, 250, 0), location.Name, "", Alignment.TopLeft, Alignment.TopCenter, locationPanel, true, GUI.LargeFont);
if (GameMain.GameSession.Map.SelectedConnection != null && GameMain.GameSession.Map.SelectedConnection.Mission != null)
{
var mission = GameMain.GameSession.Map.SelectedConnection.Mission;
- new GUITextBlock(new Rectangle(0, 80, 0, 20), "Mission: "+mission.Name, Color.Black*0.8f, Color.White, Alignment.TopLeft, null, locationPanel);
+ new GUITextBlock(new Rectangle(0, 80, 0, 20), "Mission: "+mission.Name, "", locationPanel);
- new GUITextBlock(new Rectangle(0, 100, 0, 20), "Reward: " + mission.Reward+" credits", Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel);
+ new GUITextBlock(new Rectangle(0, 100, 0, 20), "Reward: " + mission.Reward+" credits", "", locationPanel);
- new GUITextBlock(new Rectangle(0, 120, 0, 0), mission.Description, Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel, true);
+ new GUITextBlock(new Rectangle(0, 130, 0, 0), mission.Description, "", locationPanel, true);
}
@@ -256,14 +256,9 @@ namespace Barotrauma
private void CreateItemFrame(MapEntityPrefab ep, GUIListBox listBox, int width)
{
- Color color = ((listBox.CountChildren % 2) == 0) ? Color.Transparent : Color.White * 0.1f;
-
- GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 50), Color.Transparent, null, listBox);
+ GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 50), "ListBoxElement", listBox);
frame.UserData = ep;
frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
- frame.Color = color;
- frame.HoverColor = Color.Gold * 0.2f;
- frame.SelectedColor = Color.Gold * 0.5f;
frame.ToolTip = ep.Description;
@@ -272,16 +267,16 @@ namespace Barotrauma
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(50, 0, 0, 25),
ep.Name,
- Color.Transparent, Color.White,
+ null,null,
Alignment.Left, Alignment.CenterX | Alignment.Left,
- null, frame);
+ "", frame);
textBlock.Font = font;
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
textBlock.ToolTip = ep.Description;
if (ep.sprite != null)
{
- GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), ep.sprite, Alignment.Left, frame);
+ GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), ep.sprite, Alignment.CenterLeft, frame);
img.Color = ep.SpriteColor;
img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f);
}
@@ -290,7 +285,7 @@ namespace Barotrauma
new Rectangle(width - 80, 0, 80, 25),
ep.Price.ToString(),
null, null, Alignment.TopLeft,
- Alignment.TopLeft, GUI.Style, frame);
+ Alignment.TopLeft, "", frame);
textBlock.Font = font;
textBlock.ToolTip = ep.Description;
@@ -493,7 +488,7 @@ namespace Barotrauma
previewFrame = new GUIFrame(new Rectangle(0, 60, width, 300),
new Color(0.0f, 0.0f, 0.0f, 0.8f),
- Alignment.TopCenter, GUI.Style, bottomPanel[selectedRightPanel]);
+ Alignment.TopCenter, "", bottomPanel[selectedRightPanel]);
previewFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
previewFrame.UserData = characterInfo;
@@ -502,7 +497,7 @@ namespace Barotrauma
if (component.Parent == hireList)
{
- GUIButton hireButton = new GUIButton(new Rectangle(0,0, 100, 20), "Hire", Alignment.BottomCenter, GUI.Style, previewFrame);
+ GUIButton hireButton = new GUIButton(new Rectangle(0,0, 100, 20), "Hire", Alignment.BottomCenter, "", previewFrame);
hireButton.UserData = characterInfo;
hireButton.OnClicked = HireCharacter;
}
diff --git a/Subsurface/Source/Screens/MainMenuScreen.cs b/Subsurface/Source/Screens/MainMenuScreen.cs
index 340edb26b..688ce7944 100644
--- a/Subsurface/Source/Screens/MainMenuScreen.cs
+++ b/Subsurface/Source/Screens/MainMenuScreen.cs
@@ -26,7 +26,7 @@ namespace Barotrauma
private GameMain game;
- int selectedTab;
+ private Tab selectedTab;
public MainMenuScreen(GameMain game)
{
@@ -42,41 +42,42 @@ namespace Barotrauma
Rectangle panelRect = new Rectangle(
290, y,
500, 360);
-
- GUIButton button = new GUIButton(new Rectangle(50, y, 200, 30), "Tutorial", null, Alignment.TopLeft, Alignment.Left, GUI.Style, buttonsTab);
+
+ GUIButton button = new GUIButton(new Rectangle(50, y, 200, 30), "Tutorial", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
+
button.Color = button.Color * 0.8f;
button.OnClicked = TutorialButtonClicked;
- button = new GUIButton(new Rectangle(50, y + 60, 200, 30), "New Game", null, Alignment.TopLeft, Alignment.Left, GUI.Style, buttonsTab);
+ button = new GUIButton(new Rectangle(50, y + 60, 200, 30), "New Game", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button.Color = button.Color * 0.8f;
button.UserData = Tab.NewGame;
button.OnClicked = SelectTab;
- button = new GUIButton(new Rectangle(50, y + 100, 200, 30), "Load Game", null, Alignment.TopLeft, Alignment.Left, GUI.Style, buttonsTab);
+ button = new GUIButton(new Rectangle(50, y + 100, 200, 30), "Load Game", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button.Color = button.Color * 0.8f;
button.UserData = Tab.LoadGame;
button.OnClicked = SelectTab;
- button = new GUIButton(new Rectangle(50, y + 160, 200, 30), "Join Server", null, Alignment.TopLeft, Alignment.Left, GUI.Style, buttonsTab);
+ button = new GUIButton(new Rectangle(50, y + 160, 200, 30), "Join Server", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button.Color = button.Color * 0.8f;
//button.UserData = (int)Tabs.JoinServer;
button.OnClicked = JoinServerClicked;
- button = new GUIButton(new Rectangle(50, y + 200, 200, 30), "Host Server", null, Alignment.TopLeft, Alignment.Left, GUI.Style, buttonsTab);
+ button = new GUIButton(new Rectangle(50, y + 200, 200, 30), "Host Server", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button.Color = button.Color * 0.8f;
button.UserData = Tab.HostServer;
button.OnClicked = SelectTab;
- button = new GUIButton(new Rectangle(50, y + 260, 200, 30), "Submarine Editor", null, Alignment.TopLeft, Alignment.Left, GUI.Style, buttonsTab);
+ button = new GUIButton(new Rectangle(50, y + 260, 200, 30), "Submarine Editor", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button.Color = button.Color * 0.8f;
button.OnClicked = (GUIButton btn, object userdata) => { GameMain.EditMapScreen.Select(); return true; };
- button = new GUIButton(new Rectangle(50, y + 320, 200, 30), "Settings", null, Alignment.TopLeft, Alignment.Left, GUI.Style, buttonsTab);
+ button = new GUIButton(new Rectangle(50, y + 320, 200, 30), "Settings", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
button.Color = button.Color * 0.8f;
button.UserData = Tab.Settings;
button.OnClicked = SelectTab;
- button = new GUIButton(new Rectangle(0, 0, 150, 30), "Quit", Alignment.BottomRight, GUI.Style, buttonsTab);
+ button = new GUIButton(new Rectangle(0, 0, 150, 30), "Quit", Alignment.BottomRight, "", buttonsTab);
button.Color = button.Color * 0.8f;
button.OnClicked = QuitClicked;
@@ -84,31 +85,31 @@ namespace Barotrauma
//----------------------------------------------------------------------
- menuTabs[(int)Tab.NewGame] = new GUIFrame(panelRect, GUI.Style);
+ menuTabs[(int)Tab.NewGame] = new GUIFrame(panelRect, "");
menuTabs[(int)Tab.NewGame].Padding = new Vector4(20.0f,20.0f,20.0f,20.0f);
- //new GUITextBlock(new Rectangle(0, -20, 0, 30), "New Game", null, null, Alignment.CenterX, GUI.style, menuTabs[(int)Tabs.NewGame]);
+ //new GUITextBlock(new Rectangle(0, -20, 0, 30), "New Game", null, null, Alignment.CenterX, "", menuTabs[(int)Tabs.NewGame]);
- new GUITextBlock(new Rectangle(0, 0, 0, 30), "Selected submarine:", null, null, Alignment.Left, GUI.Style, menuTabs[(int)Tab.NewGame]);
- subList = new GUIListBox(new Rectangle(0, 30, 230, panelRect.Height-100), GUI.Style, menuTabs[(int)Tab.NewGame]);
+ new GUITextBlock(new Rectangle(0, 0, 0, 30), "Selected submarine:", null, null, Alignment.Left, "", menuTabs[(int)Tab.NewGame]);
+ subList = new GUIListBox(new Rectangle(0, 30, 230, panelRect.Height-100), "", menuTabs[(int)Tab.NewGame]);
UpdateSubList();
new GUITextBlock(new Rectangle((int)(subList.Rect.Width + 20), 0, 100, 20),
- "Save name: ", GUI.Style, Alignment.Left, Alignment.Left, menuTabs[(int)Tab.NewGame]);
+ "Save name: ", "", Alignment.Left, Alignment.Left, menuTabs[(int)Tab.NewGame]);
saveNameBox = new GUITextBox(new Rectangle((int)(subList.Rect.Width + 30), 30, 180, 20),
- Alignment.TopLeft, GUI.Style, menuTabs[(int)Tab.NewGame]);
+ Alignment.TopLeft, "", menuTabs[(int)Tab.NewGame]);
new GUITextBlock(new Rectangle((int)(subList.Rect.Width + 20), 60, 100, 20),
- "Map Seed: ", GUI.Style, Alignment.Left, Alignment.Left, menuTabs[(int)Tab.NewGame]);
+ "Map Seed: ", "", Alignment.Left, Alignment.Left, menuTabs[(int)Tab.NewGame]);
seedBox = new GUITextBox(new Rectangle((int)(subList.Rect.Width + 30), 90, 180, 20),
- Alignment.TopLeft, GUI.Style, menuTabs[(int)Tab.NewGame]);
+ Alignment.TopLeft, "", menuTabs[(int)Tab.NewGame]);
seedBox.Text = ToolBox.RandomSeed(8);
- button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, GUI.Style, menuTabs[(int)Tab.NewGame]);
+ button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, "", menuTabs[(int)Tab.NewGame]);
button.OnClicked = (GUIButton btn, object userData) =>
{
Submarine selectedSub = subList.SelectedData as Submarine;
@@ -130,43 +131,41 @@ namespace Barotrauma
return true;
};
-
- // Submarine selectedSub = subList.SelectedData as Submarine;
-
+
//----------------------------------------------------------------------
- menuTabs[(int)Tab.LoadGame] = new GUIFrame(panelRect, GUI.Style);
+ menuTabs[(int)Tab.LoadGame] = new GUIFrame(panelRect, "");
//menuTabs[(int)Tabs.LoadGame].Padding = GUI.style.smallPadding;
- menuTabs[(int)Tab.HostServer] = new GUIFrame(panelRect, GUI.Style);
+ menuTabs[(int)Tab.HostServer] = new GUIFrame(panelRect, "");
//menuTabs[(int)Tabs.JoinServer].Padding = GUI.style.smallPadding;
- //new GUITextBlock(new Rectangle(0, -25, 0, 30), "Host Server", GUI.style, Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.HostServer], false, GUI.LargeFont);
+ //new GUITextBlock(new Rectangle(0, -25, 0, 30), "Host Server", "", Alignment.CenterX, Alignment.CenterX, menuTabs[(int)Tabs.HostServer], false, GUI.LargeFont);
- new GUITextBlock(new Rectangle(0, 0, 100, 30), "Server Name:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
- serverNameBox = new GUITextBox(new Rectangle(160, 0, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tab.HostServer]);
+ new GUITextBlock(new Rectangle(0, 0, 100, 30), "Server Name:", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
+ serverNameBox = new GUITextBox(new Rectangle(160, 0, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
- new GUITextBlock(new Rectangle(0, 50, 100, 30), "Server port:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
- portBox = new GUITextBox(new Rectangle(160, 50, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tab.HostServer]);
+ new GUITextBlock(new Rectangle(0, 50, 100, 30), "Server port:", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
+ portBox = new GUITextBox(new Rectangle(160, 50, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
portBox.Text = NetConfig.DefaultPort.ToString();
portBox.ToolTip = "Server port";
- new GUITextBlock(new Rectangle(0, 100, 100, 30), "Max players:", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
- maxPlayersBox = new GUITextBox(new Rectangle(195, 100, 30, 30), null, null, Alignment.TopLeft, Alignment.Center, GUI.Style, menuTabs[(int)Tab.HostServer]);
+ new GUITextBlock(new Rectangle(0, 100, 100, 30), "Max players:", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
+ maxPlayersBox = new GUITextBox(new Rectangle(195, 100, 30, 30), null, null, Alignment.TopLeft, Alignment.Center, "", menuTabs[(int)Tab.HostServer]);
maxPlayersBox.Text = "8";
maxPlayersBox.Enabled = false;
- var minusPlayersBox = new GUIButton(new Rectangle(160, 100, 30, 30), "-", GUI.Style, menuTabs[(int)Tab.HostServer]);
+ var minusPlayersBox = new GUIButton(new Rectangle(160, 100, 30, 30), "-", "", menuTabs[(int)Tab.HostServer]);
minusPlayersBox.UserData = -1;
minusPlayersBox.OnClicked = ChangeMaxPlayers;
- var plusPlayersBox = new GUIButton(new Rectangle(230, 100, 30, 30), "+", GUI.Style, menuTabs[(int)Tab.HostServer]);
+ var plusPlayersBox = new GUIButton(new Rectangle(230, 100, 30, 30), "+", "", menuTabs[(int)Tab.HostServer]);
plusPlayersBox.UserData = 1;
plusPlayersBox.OnClicked = ChangeMaxPlayers;
- new GUITextBlock(new Rectangle(0, 150, 100, 30), "Password (optional):", GUI.Style, Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
- passwordBox = new GUITextBox(new Rectangle(160, 150, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, GUI.Style, menuTabs[(int)Tab.HostServer]);
+ new GUITextBlock(new Rectangle(0, 150, 100, 30), "Password (optional):", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
+ passwordBox = new GUITextBox(new Rectangle(160, 150, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
isPublicBox = new GUITickBox(new Rectangle(10, 200, 20, 20), "Public server", Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
isPublicBox.ToolTip = "Public servers are shown in the list of available servers in the \"Join Server\" -tab";
@@ -177,7 +176,7 @@ namespace Barotrauma
+ " However, UPnP isn't supported by all routers, so you may need to setup port forwards manually"
+" if players are unable to join the server (see the readme for instructions).";
- GUIButton hostButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, GUI.Style, menuTabs[(int)Tab.HostServer]);
+ GUIButton hostButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, "", menuTabs[(int)Tab.HostServer]);
hostButton.OnClicked = HostServerClicked;
this.game = game;
@@ -198,7 +197,6 @@ namespace Barotrauma
UpdateSubList();
SelectTab(null, 0);
- //selectedTab = 0;
}
private void UpdateSubList()
@@ -211,7 +209,7 @@ namespace Barotrauma
{
var textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
- ToolBox.LimitString(sub.Name, GUI.Font, subList.Rect.Width - 65), GUI.Style,
+ ToolBox.LimitString(sub.Name, GUI.Font, subList.Rect.Width - 65), "ListBoxElement",
Alignment.Left, Alignment.Left, subList)
{
Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f),
@@ -223,7 +221,7 @@ namespace Barotrauma
{
textBlock.TextColor = textBlock.TextColor * 0.85f;
- var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", GUI.Style, Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
+ var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
shuttleText.TextColor = textBlock.TextColor * 0.8f;
shuttleText.ToolTip = textBlock.ToolTip;
}
@@ -273,42 +271,41 @@ namespace Barotrauma
return;
}
- selectedTab = (int)tab;
+ selectedTab = tab;
switch (selectedTab)
{
- case (int)Tab.NewGame:
+ case Tab.NewGame:
saveNameBox.Text = SaveUtil.CreateSavePath();
break;
- case (int)Tab.LoadGame:
+ case Tab.LoadGame:
UpdateLoadScreen();
break;
- case (int)Tab.Settings:
+ case Tab.Settings:
GameMain.Config.ResetSettingsFrame();
menuTabs[(int)Tab.Settings] = GameMain.Config.SettingsFrame;
break;
}
}
- private bool ApplySettings(GUIButton button, object obj)
+ private bool ApplySettings(GUIButton button, object userData)
{
GameMain.Config.Save("config.xml");
- selectedTab = 0;
+
+ if (userData is Tab) SelectTab((Tab)userData);
if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
{
new GUIMessageBox("Restart required", "You need to restart the game for the resolution changes to take effect.");
}
-
-
return true;
}
- private bool DiscardSettings(GUIButton button, object obj)
+ private bool DiscardSettings(GUIButton button, object userData)
{
GameMain.Config.Load("config.xml");
- selectedTab = (int)obj;
+ if (userData is Tab) SelectTab((Tab)userData);
return true;
}
@@ -388,7 +385,7 @@ namespace Barotrauma
string[] saveFiles = SaveUtil.GetSaveFiles();
- saveList = new GUIListBox(new Rectangle(0, 0, 200, menuTabs[(int)Tab.LoadGame].Rect.Height - 80), Color.White, GUI.Style, menuTabs[(int)Tab.LoadGame]);
+ saveList = new GUIListBox(new Rectangle(0, 0, 200, menuTabs[(int)Tab.LoadGame].Rect.Height - 80), Color.White, "", menuTabs[(int)Tab.LoadGame]);
saveList.OnSelected = SelectSaveFile;
foreach (string saveFile in saveFiles)
@@ -396,7 +393,7 @@ namespace Barotrauma
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
saveFile,
- GUI.Style,
+ "ListBoxElement",
Alignment.Left,
Alignment.Left,
saveList);
@@ -404,7 +401,7 @@ namespace Barotrauma
textBlock.UserData = saveFile;
}
- var button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.Right | Alignment.Bottom, GUI.Style, menuTabs[(int)Tab.LoadGame]);
+ var button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.Right | Alignment.Bottom, "", menuTabs[(int)Tab.LoadGame]);
button.OnClicked = LoadGame;
}
@@ -428,22 +425,22 @@ namespace Barotrauma
string mapseed = ToolBox.GetAttributeString(doc.Root, "mapseed", "unknown");
- GUIFrame saveFileFrame = new GUIFrame(new Rectangle((int)(saveList.Rect.Width + 20), 0, 200, 230), Color.Black*0.4f, GUI.Style, menuTabs[(int)Tab.LoadGame]);
+ GUIFrame saveFileFrame = new GUIFrame(new Rectangle((int)(saveList.Rect.Width + 20), 0, 200, 230), Color.Black*0.4f, "", menuTabs[(int)Tab.LoadGame]);
saveFileFrame.UserData = "savefileframe";
saveFileFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
- new GUITextBlock(new Rectangle(0,0,0,20), fileName, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, saveFileFrame, false, GUI.LargeFont);
+ new GUITextBlock(new Rectangle(0,0,0,20), fileName, "", Alignment.TopLeft, Alignment.TopLeft, saveFileFrame, false, GUI.LargeFont);
- new GUITextBlock(new Rectangle(0, 35, 0, 20), "Submarine: ", GUI.Style, saveFileFrame).Font = GUI.SmallFont;
- new GUITextBlock(new Rectangle(15, 52, 0, 20), subName, GUI.Style, saveFileFrame).Font = GUI.SmallFont;
+ new GUITextBlock(new Rectangle(0, 35, 0, 20), "Submarine: ", "", saveFileFrame).Font = GUI.SmallFont;
+ new GUITextBlock(new Rectangle(15, 52, 0, 20), subName, "", saveFileFrame).Font = GUI.SmallFont;
- new GUITextBlock(new Rectangle(0, 70, 0, 20), "Last saved: ", GUI.Style, saveFileFrame).Font = GUI.SmallFont;
- new GUITextBlock(new Rectangle(15, 85, 0, 20), saveTime, GUI.Style, saveFileFrame).Font = GUI.SmallFont;
+ new GUITextBlock(new Rectangle(0, 70, 0, 20), "Last saved: ", "", saveFileFrame).Font = GUI.SmallFont;
+ new GUITextBlock(new Rectangle(15, 85, 0, 20), saveTime, "", saveFileFrame).Font = GUI.SmallFont;
- new GUITextBlock(new Rectangle(0, 105, 0, 20), "Map seed: ", GUI.Style, saveFileFrame).Font = GUI.SmallFont;
- new GUITextBlock(new Rectangle(15, 120, 0, 20), mapseed, GUI.Style, saveFileFrame).Font = GUI.SmallFont;
+ new GUITextBlock(new Rectangle(0, 105, 0, 20), "Map seed: ", "", saveFileFrame).Font = GUI.SmallFont;
+ new GUITextBlock(new Rectangle(15, 120, 0, 20), mapseed, "", saveFileFrame).Font = GUI.SmallFont;
- var deleteSaveButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Delete", Alignment.BottomCenter, GUI.Style, saveFileFrame);
+ var deleteSaveButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Delete", Alignment.BottomCenter, "", saveFileFrame);
deleteSaveButton.UserData = fileName;
deleteSaveButton.OnClicked = DeleteSave;
@@ -479,24 +476,20 @@ namespace Barotrauma
public override void AddToGUIUpdateList()
{
buttonsTab.AddToGUIUpdateList();
- if (selectedTab > 0) menuTabs[selectedTab].AddToGUIUpdateList();
+ if (selectedTab > 0) menuTabs[(int)selectedTab].AddToGUIUpdateList();
}
public override void Update(double deltaTime)
{
- //GameMain.TitleScreen.Update();
buttonsTab.Update((float)deltaTime);
- if (selectedTab > 0)
- {
- menuTabs[selectedTab].Update((float)deltaTime);
- }
+
+ if (selectedTab>0) menuTabs[(int)selectedTab].Update((float)deltaTime);
GameMain.TitleScreen.TitlePosition =
Vector2.Lerp(GameMain.TitleScreen.TitlePosition, new Vector2(
GameMain.TitleScreen.TitleSize.X / 2.0f * GameMain.TitleScreen.Scale + 30.0f,
GameMain.TitleScreen.TitleSize.Y / 2.0f * GameMain.TitleScreen.Scale + 30.0f),
- 0.1f);
-
+ 0.1f);
}
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
@@ -511,7 +504,7 @@ namespace Barotrauma
spriteBatch.Begin(0, BlendState.AlphaBlend);
buttonsTab.Draw(spriteBatch);
- if (selectedTab>0) menuTabs[selectedTab].Draw(spriteBatch);
+ if (selectedTab>0) menuTabs[(int)selectedTab].Draw(spriteBatch);
GUI.Draw((float)deltaTime, spriteBatch, null);
diff --git a/Subsurface/Source/Screens/NetLobbyScreen.cs b/Subsurface/Source/Screens/NetLobbyScreen.cs
index f5be32630..ea8dcfc8b 100644
--- a/Subsurface/Source/Screens/NetLobbyScreen.cs
+++ b/Subsurface/Source/Screens/NetLobbyScreen.cs
@@ -180,12 +180,12 @@ namespace Barotrauma
Rectangle panelRect = new Rectangle(0,0,width,height);
- menu = new GUIFrame(panelRect, Color.Transparent, Alignment.Center);
+ menu = new GUIFrame(panelRect, Color.Transparent, Alignment.Center, null);
//menu.Padding = GUI.style.smallPadding;
//server info panel ------------------------------------------------------------
- infoFrame = new GUIFrame(new Rectangle(0, 0, (int)(panelRect.Width * 0.7f), (int)(panelRect.Height * 0.6f)), GUI.Style, menu);
+ infoFrame = new GUIFrame(new Rectangle(0, 0, (int)(panelRect.Width * 0.7f), (int)(panelRect.Height * 0.6f)), "", menu);
infoFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
//chatbox ----------------------------------------------------------------------
@@ -193,11 +193,11 @@ namespace Barotrauma
new Rectangle(0, (int)(panelRect.Height * 0.6f + 20),
(int)(panelRect.Width * 0.7f),
(int)(panelRect.Height * 0.4f - 20)),
- GUI.Style, menu);
+ "", menu);
chatFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 40.0f);
- chatBox = new GUIListBox(new Rectangle(0,0,0,chatFrame.Rect.Height-80), Color.White, GUI.Style, chatFrame);
- textBox = new GUITextBox(new Rectangle(0, 25, 0, 25), Alignment.Bottom, GUI.Style, chatFrame);
+ chatBox = new GUIListBox(new Rectangle(0,0,0,chatFrame.Rect.Height-80), Color.White, "", chatFrame);
+ textBox = new GUITextBox(new Rectangle(0, 25, 0, 25), Alignment.Bottom, "", chatFrame);
textBox.Font = GUI.SmallFont;
//player info panel ------------------------------------------------------------
@@ -205,7 +205,7 @@ namespace Barotrauma
myPlayerFrame = new GUIFrame(
new Rectangle((int)(panelRect.Width * 0.7f + 20), 0,
(int)(panelRect.Width * 0.3f - 20), (int)(panelRect.Height * 0.6f)),
- GUI.Style, menu);
+ "", menu);
myPlayerFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
//player list ------------------------------------------------------------------
@@ -213,11 +213,11 @@ namespace Barotrauma
GUIFrame playerListFrame = new GUIFrame(
new Rectangle((int)(panelRect.Width * 0.7f + 20), (int)(panelRect.Height * 0.6f + 20),
(int)(panelRect.Width * 0.3f - 20), (int)(panelRect.Height * 0.4f - 20)),
- GUI.Style, menu);
+ "", menu);
playerListFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 40.0f);
- playerList = new GUIListBox(new Rectangle(0,0,0,0), null, GUI.Style, playerListFrame);
+ playerList = new GUIListBox(new Rectangle(0,0,0,0), null, "", playerListFrame);
playerList.OnSelected = SelectPlayer;
//submarine list ------------------------------------------------------------------
@@ -225,11 +225,11 @@ namespace Barotrauma
int columnWidth = infoFrame.Rect.Width / 3 - 5;
int columnX = 0;
- new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 30), "Submarine:", GUI.Style, infoFrame);
- subList = new GUIListBox(new Rectangle(columnX, 150, columnWidth, infoFrame.Rect.Height - 150 - 80), Color.White, GUI.Style, infoFrame);
+ new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 30), "Submarine:", "", infoFrame);
+ subList = new GUIListBox(new Rectangle(columnX, 150, columnWidth, infoFrame.Rect.Height - 150 - 80), Color.White, "", infoFrame);
subList.OnSelected = VotableClicked;
- var voteText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 30), "Votes: ", GUI.Style, Alignment.TopLeft, Alignment.TopRight, infoFrame);
+ var voteText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 30), "Votes: ", "", Alignment.TopLeft, Alignment.TopRight, infoFrame);
voteText.UserData = "subvotes";
voteText.Visible = false;
@@ -240,17 +240,17 @@ namespace Barotrauma
//respawn shuttle ------------------------------------------------------------------
- new GUITextBlock(new Rectangle(columnX, 120, 20, 20), "Respawn shuttle:", GUI.Style, infoFrame);
- shuttleList = new GUIDropDown(new Rectangle(columnX, 150, 200, 20), "", GUI.Style, infoFrame);
+ new GUITextBlock(new Rectangle(columnX, 120, 20, 20), "Respawn shuttle:", "", infoFrame);
+ shuttleList = new GUIDropDown(new Rectangle(columnX, 150, 200, 20), "", "", infoFrame);
//gamemode ------------------------------------------------------------------
- new GUITextBlock(new Rectangle(columnX, 180, 0, 30), "Game mode: ", GUI.Style, infoFrame);
- modeList = new GUIListBox(new Rectangle(columnX, 200, columnWidth, infoFrame.Rect.Height - 300), GUI.Style, infoFrame);
+ new GUITextBlock(new Rectangle(columnX, 180, 0, 30), "Game mode: ", "", infoFrame);
+ modeList = new GUIListBox(new Rectangle(columnX, 200, columnWidth, infoFrame.Rect.Height - 300), "", infoFrame);
modeList.OnSelected = VotableClicked;
- voteText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 30), "Votes: ", GUI.Style, Alignment.TopLeft, Alignment.TopRight, infoFrame);
+ voteText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 30), "Votes: ", "", Alignment.TopLeft, Alignment.TopRight, infoFrame);
voteText.UserData = "modevotes";
voteText.Visible = false;
@@ -260,8 +260,8 @@ namespace Barotrauma
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
- mode.Name, GUI.Style,
- Alignment.Left, Alignment.Left,
+ mode.Name, "ListBoxElement",
+ Alignment.TopLeft, Alignment.CenterLeft,
modeList);
textBlock.ToolTip = mode.Description;
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
@@ -270,17 +270,17 @@ namespace Barotrauma
//mission type ------------------------------------------------------------------
- missionTypeBlock = new GUITextBlock(new Rectangle(columnX, 0, 300, 20), "Mission type:", GUI.Style, Alignment.BottomLeft, Alignment.TopLeft, infoFrame);
+ missionTypeBlock = new GUITextBlock(new Rectangle(columnX, 0, 300, 20), "Mission type:", "", Alignment.BottomLeft, Alignment.TopLeft, infoFrame);
missionTypeBlock.UserData = 0;
missionTypeButtons = new GUIButton[2];
- missionTypeButtons[0] = new GUIButton(new Rectangle(100, 0, 20, 20), "<", Alignment.BottomLeft, GUI.Style, missionTypeBlock);
+ missionTypeButtons[0] = new GUIButton(new Rectangle(100, 0, 20, 20), "<", Alignment.BottomLeft, "", missionTypeBlock);
missionTypeButtons[0].UserData = -1;
- new GUITextBlock(new Rectangle(120, 0, 80, 20), "Random", GUI.Style, Alignment.BottomLeft, Alignment.TopCenter, missionTypeBlock).UserData = 0;
+ new GUITextBlock(new Rectangle(120, 0, 80, 20), "Random", "", Alignment.BottomLeft, Alignment.TopCenter, missionTypeBlock).UserData = 0;
- missionTypeButtons[1] = new GUIButton(new Rectangle(200, 0, 20, 20), ">", Alignment.BottomLeft, GUI.Style, missionTypeBlock);
+ missionTypeButtons[1] = new GUIButton(new Rectangle(200, 0, 20, 20), ">", Alignment.BottomLeft, "", missionTypeBlock);
missionTypeButtons[1].UserData = 1;
missionTypeBlock.Visible = false;
@@ -291,7 +291,7 @@ namespace Barotrauma
//var modeDescription = new GUITextBlock(
// new Rectangle(columnX, 150, (int)(columnWidth * 1.2f), infoFrame.Rect.Height - 150 - 80),
- // "", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, infoFrame, true, GUI.SmallFont);
+ // "", "", Alignment.TopLeft, Alignment.TopLeft, infoFrame, true, GUI.SmallFont);
//modeDescription.Color = Color.Black * 0.3f;
//modeList.UserData = modeDescription;
@@ -301,25 +301,25 @@ namespace Barotrauma
//seed ------------------------------------------------------------------
new GUITextBlock(new Rectangle(columnX, 120, 180, 20),
- "Level Seed: ", GUI.Style, Alignment.Left, Alignment.TopLeft, infoFrame);
+ "Level Seed: ", "", Alignment.Left, Alignment.TopLeft, infoFrame);
seedBox = new GUITextBox(new Rectangle(columnX, 150, columnWidth/2, 20),
- Alignment.TopLeft, GUI.Style, infoFrame);
+ Alignment.TopLeft, "", infoFrame);
seedBox.OnTextChanged = SelectSeed;
LevelSeed = ToolBox.RandomSeed(8);
//traitor probability ------------------------------------------------------------------
- new GUITextBlock(new Rectangle(columnX, 180, 20, 20), "Traitors:", GUI.Style, infoFrame);
+ new GUITextBlock(new Rectangle(columnX, 180, 20, 20), "Traitors:", "", infoFrame);
traitorProbabilityButtons = new GUIButton[2];
- traitorProbabilityButtons[0] = new GUIButton(new Rectangle(columnX, 205, 20, 20), "<", GUI.Style, infoFrame);
+ traitorProbabilityButtons[0] = new GUIButton(new Rectangle(columnX, 205, 20, 20), "<", "", infoFrame);
traitorProbabilityButtons[0].UserData = -1;
- traitorProbabilityText = new GUITextBlock(new Rectangle(columnX+20, 205, 80, 20), "No", null,null, Alignment.TopCenter, GUI.Style, infoFrame);
+ traitorProbabilityText = new GUITextBlock(new Rectangle(columnX+20, 205, 80, 20), "No", null,null, Alignment.Center, "", infoFrame);
- traitorProbabilityButtons[1] = new GUIButton(new Rectangle(columnX + 100, 205, 20, 20), ">", GUI.Style, infoFrame);
+ traitorProbabilityButtons[1] = new GUIButton(new Rectangle(columnX + 100, 205, 20, 20), ">", "", infoFrame);
traitorProbabilityButtons[1].UserData = 1;
@@ -328,18 +328,18 @@ namespace Barotrauma
autoRestartBox = new GUITickBox(new Rectangle(columnX, 240, 20, 20), "Automatic restart", Alignment.TopLeft, infoFrame);
autoRestartBox.OnSelected = ToggleAutoRestart;
- var restartText = new GUITextBlock(new Rectangle(columnX, 265, 20, 20), "", GUI.Style, infoFrame);
+ var restartText = new GUITextBlock(new Rectangle(columnX, 265, 20, 20), "", "", infoFrame);
restartText.Font = GUI.SmallFont;
restartText.TextGetter = AutoRestartText;
//server info ------------------------------------------------------------------
- var serverName = new GUITextBox(new Rectangle(0, 0, 200, 20), null, null, Alignment.TopLeft, Alignment.TopLeft, GUI.Style, infoFrame);
+ var serverName = new GUITextBox(new Rectangle(0, 0, 200, 20), null, null, Alignment.TopLeft, Alignment.TopLeft, "", infoFrame);
serverName.TextGetter = GetServerName;
serverName.Enabled = GameMain.Server != null;
serverName.OnTextChanged = ChangeServerName;
- serverMessage = new GUITextBox(new Rectangle(0, 30, 360, 70), null, null, Alignment.TopLeft, Alignment.TopLeft, GUI.Style, infoFrame);
+ serverMessage = new GUITextBox(new Rectangle(0, 30, 360, 70), null, null, Alignment.TopLeft, Alignment.TopLeft, "", infoFrame);
serverMessage.Wrap = true;
serverMessage.OnTextChanged = UpdateServerMessage;
@@ -407,10 +407,10 @@ namespace Barotrauma
missionTypeButtons[0].OnClicked = ToggleMissionType;
missionTypeButtons[1].OnClicked = ToggleMissionType;
- StartButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Start", Alignment.BottomRight, GUI.Style, infoFrame);
+ StartButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Start", Alignment.BottomRight, "", infoFrame);
StartButton.OnClicked = GameMain.Server.StartGameClicked;
- GUIButton settingsButton = new GUIButton(new Rectangle(-100, 0, 80, 30), "Settings", Alignment.BottomRight, GUI.Style, infoFrame);
+ GUIButton settingsButton = new GUIButton(new Rectangle(-100, 0, 80, 30), "Settings", Alignment.BottomRight, "", infoFrame);
settingsButton.OnClicked = GameMain.Server.ToggleSettingsFrame;
settingsButton.UserData = "settingsButton";
@@ -432,7 +432,7 @@ namespace Barotrauma
if (myPlayerFrame.children.Find(c => c.UserData as string == "playyourself") == null)
{
- var playYourself = new GUITickBox(new Rectangle(0, -10, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
+ var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
playYourself.Selected = GameMain.Server.CharacterInfo != null;
playYourself.OnSelected = TogglePlayYourself;
playYourself.UserData = "playyourself";
@@ -452,7 +452,7 @@ namespace Barotrauma
{
if (GameMain.Client.GameStarted)
{
- GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Spectate", Alignment.BottomRight, GUI.Style, infoFrame);
+ GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Spectate", Alignment.BottomRight, "", infoFrame);
spectateButton.OnClicked = GameMain.Client.SpectateClicked;
spectateButton.UserData = "spectateButton";
}
@@ -473,7 +473,7 @@ namespace Barotrauma
if (GameMain.Client == null) return;
infoFrame.RemoveChild(infoFrame.children.Find(c => c.UserData as string == "spectateButton"));
- GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Spectate", Alignment.BottomRight, GUI.Style, infoFrame);
+ GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Spectate", Alignment.BottomRight, "", infoFrame);
spectateButton.OnClicked = GameMain.Client.SpectateClicked;
spectateButton.UserData = "spectateButton";
}
@@ -486,40 +486,40 @@ namespace Barotrauma
if (IsServer && GameMain.Server != null)
{
- var playYourself = new GUITickBox(new Rectangle(0, -10, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
+ var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
playYourself.Selected = GameMain.Server.CharacterInfo != null;
playYourself.OnSelected = TogglePlayYourself;
playYourself.UserData = "playyourself";
}
- //new GUITextBlock(new Rectangle(100, 30, 200, 30), "Name: ", GUI.Style, myPlayerFrame);
+ //new GUITextBlock(new Rectangle(100, 30, 200, 30), "Name: ", "", myPlayerFrame);
- //GUITextBox playerName = new GUITextBox(new Rectangle(100, 55, 0, 20), Alignment.TopLeft, GUI.Style, myPlayerFrame);
+ //GUITextBox playerName = new GUITextBox(new Rectangle(100, 55, 0, 20), Alignment.TopLeft, "", myPlayerFrame);
//playerName.Text = characterInfo.Name;
//playerName.OnEnterPressed += ChangeCharacterName;
- GUIButton toggleHead = new GUIButton(new Rectangle(0, 50, 15, 15), "<", GUI.Style, myPlayerFrame);
+ GUIButton toggleHead = new GUIButton(new Rectangle(0, 50, 15, 15), "<", "", myPlayerFrame);
toggleHead.UserData = -1;
toggleHead.OnClicked = ToggleHead;
- toggleHead = new GUIButton(new Rectangle(60, 50, 15, 15), ">", GUI.Style, myPlayerFrame);
+ toggleHead = new GUIButton(new Rectangle(60, 50, 15, 15), ">", "", myPlayerFrame);
toggleHead.UserData = 1;
toggleHead.OnClicked = ToggleHead;
- new GUITextBlock(new Rectangle(100, 30, 200, 30), "Gender: ", GUI.Style, myPlayerFrame);
+ new GUITextBlock(new Rectangle(100, 30, 200, 30), "Gender: ", "", myPlayerFrame);
GUIButton maleButton = new GUIButton(new Rectangle(100, 50, 60, 20), "Male",
- Alignment.TopLeft, GUI.Style, myPlayerFrame);
+ Alignment.TopLeft, "", myPlayerFrame);
maleButton.UserData = Gender.Male;
maleButton.OnClicked += SwitchGender;
GUIButton femaleButton = new GUIButton(new Rectangle(170, 50, 60, 20), "Female",
- Alignment.TopLeft, GUI.Style, myPlayerFrame);
+ Alignment.TopLeft, "", myPlayerFrame);
femaleButton.UserData = Gender.Female;
femaleButton.OnClicked += SwitchGender;
- new GUITextBlock(new Rectangle(0, 120, 20, 30), "Job preferences:", GUI.Style, myPlayerFrame);
+ new GUITextBlock(new Rectangle(0, 120, 20, 30), "Job preferences:", "", myPlayerFrame);
- jobList = new GUIListBox(new Rectangle(0, 150, 0, 0), GUI.Style, myPlayerFrame);
+ jobList = new GUIListBox(new Rectangle(0, 150, 0, 0), "", myPlayerFrame);
jobList.Enabled = false;
@@ -527,22 +527,22 @@ namespace Barotrauma
foreach (JobPrefab job in JobPrefab.List)
{
GUITextBlock jobText = new GUITextBlock(new Rectangle(0, 0, 0, 20), i + ". " + job.Name+" ",
- GUI.Style,Alignment.Left, Alignment.Right, jobList, false,
+ "",Alignment.Left, Alignment.Right, jobList, false,
GameMain.GraphicsWidth<1000 ? GUI.SmallFont : GUI.Font);
jobText.UserData = job;
- GUIButton infoButton = new GUIButton(new Rectangle(0, 2, 15, 15), "?", GUI.Style, jobText);
+ GUIButton infoButton = new GUIButton(new Rectangle(0, 2, 15, 15), "?", "", jobText);
infoButton.UserData = -1;
infoButton.OnClicked += ViewJobInfo;
- GUIButton upButton = new GUIButton(new Rectangle(30, 2, 15, 15), "", GUI.Style, jobText);
+ GUIButton upButton = new GUIButton(new Rectangle(30, 2, 15, 15), "", "", jobText);
//TODO: make GUIImages align correctly when scaled/rotated
//so there's no need to do this ↓
new GUIImage(new Rectangle(3,2,0,0), GUI.Arrow, Alignment.Center, upButton).Scale = 0.6f;
upButton.UserData = -1;
upButton.OnClicked += ChangeJobPreference;
- GUIButton downButton = new GUIButton(new Rectangle(50, 2, 15, 15), "", GUI.Style, jobText);
+ GUIButton downButton = new GUIButton(new Rectangle(50, 2, 15, 15), "", "", jobText);
var downArrow = new GUIImage(new Rectangle(13,14,0,0), GUI.Arrow, Alignment.Center, downButton);
downArrow.Rotation = MathHelper.Pi;
downArrow.Scale = 0.6f;
@@ -702,8 +702,8 @@ namespace Barotrauma
public void AddSubmarine(GUIComponent subList, Submarine sub)
{
var subTextBlock = new GUITextBlock(
- new Rectangle(0, 0, 0, 25), ToolBox.LimitString(sub.Name, GUI.Font, subList.Rect.Width - 65), GUI.Style,
- Alignment.Left, Alignment.CenterY | Alignment.Left, subList)
+ new Rectangle(0, 0, 0, 25), ToolBox.LimitString(sub.Name, GUI.Font, subList.Rect.Width - 65), "ListBoxElement",
+ Alignment.TopLeft, Alignment.CenterLeft, subList)
{
Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f),
ToolTip = sub.Description,
@@ -734,7 +734,7 @@ namespace Barotrauma
if (sub.HasTag(SubmarineTag.Shuttle))
{
- var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", GUI.Style, Alignment.Left, Alignment.CenterY | Alignment.Right, subTextBlock, false, GUI.SmallFont);
+ var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", "", Alignment.Left, Alignment.CenterY | Alignment.Right, subTextBlock, false, GUI.SmallFont);
shuttleText.TextColor = subTextBlock.TextColor * 0.8f;
shuttleText.ToolTip = subTextBlock.ToolTip;
}
@@ -788,7 +788,7 @@ namespace Barotrauma
{
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, playerList.Rect.Width-20, 25), name,
- GUI.Style, Alignment.Left, Alignment.Left,
+ "", Alignment.Left, Alignment.Left,
playerList);
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
@@ -819,24 +819,24 @@ namespace Barotrauma
playerFrame = new GUIFrame(new Rectangle(0, 0, 0, 0), Color.Black * 0.6f);
- var playerFrameInner = new GUIFrame(new Rectangle(0, 0, 300, 280), null, Alignment.Center, GUI.Style, playerFrame);
+ var playerFrameInner = new GUIFrame(new Rectangle(0, 0, 300, 280), null, Alignment.Center, "", playerFrame);
playerFrameInner.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
new GUITextBlock(new Rectangle(0, 0, 200, 20), component.UserData.ToString(),
- GUI.Style, Alignment.TopLeft, Alignment.TopLeft,
+ "", Alignment.TopLeft, Alignment.TopLeft,
playerFrameInner, false, GUI.LargeFont);
if (GameMain.Server != null)
{
var selectedClient = GameMain.Server.ConnectedClients.Find(c => c.name == component.UserData.ToString());
- new GUITextBlock(new Rectangle(0, 25, 150, 15), selectedClient.Connection.RemoteEndPoint.Address.ToString(), GUI.Style, playerFrameInner);
+ new GUITextBlock(new Rectangle(0, 25, 150, 15), selectedClient.Connection.RemoteEndPoint.Address.ToString(), "", playerFrameInner);
- var permissionsBox = new GUIFrame(new Rectangle(0, 60, 0, 90), GUI.Style, playerFrameInner);
+ var permissionsBox = new GUIFrame(new Rectangle(0, 60, 0, 90), "", playerFrameInner);
permissionsBox.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
permissionsBox.UserData = selectedClient;
- new GUITextBlock(new Rectangle(0, 0, 0, 15), "Permissions:", GUI.Style, permissionsBox);
+ new GUITextBlock(new Rectangle(0, 0, 0, 15), "Permissions:", "", permissionsBox);
int x = 0, y = 0;
foreach (ClientPermissions permission in Enum.GetValues(typeof(ClientPermissions)))
{
@@ -880,7 +880,7 @@ namespace Barotrauma
if (GameMain.Server != null || GameMain.Client.HasPermission(ClientPermissions.Kick))
{
- var kickButton = new GUIButton(new Rectangle(0, -50, 100, 20), "Kick", Alignment.BottomLeft, GUI.Style, playerFrameInner);
+ var kickButton = new GUIButton(new Rectangle(0, -50, 100, 20), "Kick", Alignment.BottomLeft, "", playerFrameInner);
kickButton.UserData = obj;
kickButton.OnClicked += KickPlayer;
kickButton.OnClicked += ClosePlayerFrame;
@@ -888,18 +888,18 @@ namespace Barotrauma
if (GameMain.Server != null || GameMain.Client.HasPermission(ClientPermissions.Ban))
{
- var banButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Ban", Alignment.BottomLeft, GUI.Style, playerFrameInner);
+ var banButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Ban", Alignment.BottomLeft, "", playerFrameInner);
banButton.UserData = obj;
banButton.OnClicked += BanPlayer;
banButton.OnClicked += ClosePlayerFrame;
- var rangebanButton = new GUIButton(new Rectangle(0, -25, 100, 20), "Ban range", Alignment.BottomLeft, GUI.Style, playerFrameInner);
+ var rangebanButton = new GUIButton(new Rectangle(0, -25, 100, 20), "Ban range", Alignment.BottomLeft, "", playerFrameInner);
rangebanButton.UserData = obj;
rangebanButton.OnClicked += BanPlayerRange;
rangebanButton.OnClicked += ClosePlayerFrame;
}
- var closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Close", Alignment.BottomRight, GUI.Style, playerFrameInner);
+ var closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Close", Alignment.BottomRight, "", playerFrameInner);
closeButton.OnClicked = ClosePlayerFrame;
return false;
@@ -1046,7 +1046,7 @@ namespace Barotrauma
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width, 0),
message.TextWithSender,
((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black*0.1f, message.Color,
- Alignment.Left, GUI.Style, null, true);
+ Alignment.Left, "", null, true);
msg.Font = GUI.SmallFont;
msg.UserData = message;
msg.CanBeFocused = false;
@@ -1153,7 +1153,7 @@ namespace Barotrauma
if (jobPrefab == null) return false;
jobInfoFrame = jobPrefab.CreateInfoFrame();
- GUIButton closeButton = new GUIButton(new Rectangle(0,0,100,20), "Close", Alignment.BottomRight, GUI.Style, jobInfoFrame.children[0]);
+ GUIButton closeButton = new GUIButton(new Rectangle(0,0,100,20), "Close", Alignment.BottomRight, "", jobInfoFrame.children[0]);
closeButton.OnClicked = CloseJobInfo;
return true;
}
diff --git a/Subsurface/Source/Screens/ServerListScreen.cs b/Subsurface/Source/Screens/ServerListScreen.cs
index 010fb0d33..52d6983f9 100644
--- a/Subsurface/Source/Screens/ServerListScreen.cs
+++ b/Subsurface/Source/Screens/ServerListScreen.cs
@@ -37,23 +37,23 @@ namespace Barotrauma
Rectangle panelRect = new Rectangle(0, 0, width, height);
- menu = new GUIFrame(panelRect, null, Alignment.Center, GUI.Style);
+ menu = new GUIFrame(panelRect, null, Alignment.Center, "");
menu.Padding = new Vector4(40.0f, 40.0f, 40.0f, 20.0f);
- new GUITextBlock(new Rectangle(0, -25, 0, 30), "Join Server", GUI.Style, Alignment.CenterX, Alignment.CenterX, menu, false, GUI.LargeFont);
+ new GUITextBlock(new Rectangle(0, -25, 0, 30), "Join Server", "", Alignment.CenterX, Alignment.CenterX, menu, false, GUI.LargeFont);
- new GUITextBlock(new Rectangle(0, 30, 0, 30), "Your Name:", GUI.Style, menu);
- clientNameBox = new GUITextBox(new Rectangle(0, 60, 200, 30), GUI.Style, menu);
+ new GUITextBlock(new Rectangle(0, 30, 0, 30), "Your Name:", "", menu);
+ clientNameBox = new GUITextBox(new Rectangle(0, 60, 200, 30), "", menu);
- new GUITextBlock(new Rectangle(0, 100, 0, 30), "Server IP:", GUI.Style, menu);
- ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), GUI.Style, menu);
+ new GUITextBlock(new Rectangle(0, 100, 0, 30), "Server IP:", "", menu);
+ ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), "", menu);
int middleX = (int)(width * 0.4f);
- serverList = new GUIListBox(new Rectangle(middleX,60,0,height-160), GUI.Style, menu);
+ serverList = new GUIListBox(new Rectangle(middleX,60,0,height-160), "", menu);
serverList.OnSelected = SelectServer;
- float[] columnRelativeX = new float[] { 0.15f, 0.55f, 0.15f, 0.15f };
+ float[] columnRelativeX = new float[] { 0.15f, 0.5f, 0.15f, 0.2f };
columnX = new int[columnRelativeX.Length];
for (int n = 0; n < columnX.Length; n++)
{
@@ -63,19 +63,19 @@ namespace Barotrauma
ScalableFont font = GUI.SmallFont; // serverList.Rect.Width < 400 ? GUI.SmallFont : GUI.Font;
- new GUITextBlock(new Rectangle(middleX, 30, 0, 30), "Password", GUI.Style, menu).Font = font;
+ new GUITextBlock(new Rectangle(middleX, 30, 0, 30), "Password", "", menu).Font = font;
- new GUITextBlock(new Rectangle(middleX + columnX[0], 30, 0, 30), "Name", GUI.Style, menu).Font = font;
- new GUITextBlock(new Rectangle(middleX + columnX[1], 30, 0, 30), "Players", GUI.Style, menu).Font = font;
- new GUITextBlock(new Rectangle(middleX + columnX[2], 30, 0, 30), "Round started", GUI.Style, menu).Font = font;
+ new GUITextBlock(new Rectangle(middleX + columnX[0], 30, 0, 30), "Name", "", menu).Font = font;
+ new GUITextBlock(new Rectangle(middleX + columnX[1], 30, 0, 30), "Players", "", menu).Font = font;
+ new GUITextBlock(new Rectangle(middleX + columnX[2], 30, 0, 30), "Round started", "", menu).Font = font;
- joinButton = new GUIButton(new Rectangle(-170, 0, 150, 30), "Refresh", Alignment.BottomRight, GUI.Style, menu);
+ joinButton = new GUIButton(new Rectangle(-170, 0, 150, 30), "Refresh", Alignment.BottomRight, "", menu);
joinButton.OnClicked = RefreshServers;
- joinButton = new GUIButton(new Rectangle(0,0,150,30), "Join", Alignment.BottomRight, GUI.Style, menu);
+ joinButton = new GUIButton(new Rectangle(0,0,150,30), "Join", Alignment.BottomRight, "", menu);
joinButton.OnClicked = JoinServer;
- GUIButton button = new GUIButton(new Rectangle(-20, -20, 100, 30), "Back", Alignment.TopLeft, GUI.Style, menu);
+ GUIButton button = new GUIButton(new Rectangle(-20, -20, 100, 30), "Back", Alignment.TopLeft, "", menu);
button.OnClicked = GameMain.MainMenuScreen.SelectTab;
button.SelectedColor = button.Color;
@@ -105,7 +105,7 @@ namespace Barotrauma
if (waitingForRefresh) return false;
serverList.ClearChildren();
- new GUITextBlock(new Rectangle(0, 0, 0, 20), "Refreshing server list...", GUI.Style, serverList);
+ new GUITextBlock(new Rectangle(0, 0, 0, 20), "Refreshing server list...", "", serverList);
CoroutineManager.StartCoroutine(WaitForRefresh());
@@ -138,7 +138,7 @@ namespace Barotrauma
if (string.IsNullOrWhiteSpace(masterServerData))
{
- new GUITextBlock(new Rectangle(0, 0, 0, 20), "Couldn't find any servers", GUI.Style, serverList);
+ new GUITextBlock(new Rectangle(0, 0, 0, 20), "Couldn't find any servers", "", serverList);
return;
}
@@ -167,25 +167,23 @@ namespace Barotrauma
string hasPassWordStr = (arguments.Length > 6) ? arguments[6] : "";
- var serverFrame = new GUIFrame(new Rectangle(0, 0, 0, 20), (i % 2 == 0) ? Color.Transparent : Color.White * 0.2f, null, serverList);
+ var serverFrame = new GUIFrame(new Rectangle(0, 0, 0, 30), (i % 2 == 0) ? Color.Transparent : Color.White * 0.2f, "ListBoxElement", serverList);
serverFrame.UserData = IP + ":" + port;
- serverFrame.HoverColor = Color.Gold * 0.2f;
- serverFrame.SelectedColor = Color.Gold * 0.5f;
- var passwordBox = new GUITickBox(new Rectangle(columnX[0] / 2, 0, 20, 20), "", Alignment.TopLeft, serverFrame);
+ var passwordBox = new GUITickBox(new Rectangle(columnX[0] / 2, 0, 20, 20), "", Alignment.CenterLeft, serverFrame);
passwordBox.Selected = hasPassWordStr == "1";
passwordBox.Enabled = false;
passwordBox.UserData = "password";
- new GUITextBlock(new Rectangle(columnX[0], 0, 0, 0), serverName, GUI.Style, serverFrame);
+ new GUITextBlock(new Rectangle(columnX[0], 0, 0, 0), serverName, "", Alignment.TopLeft, Alignment.CenterLeft, serverFrame);
int playerCount = 0, maxPlayers = 1;
int.TryParse(currPlayersStr, out playerCount);
int.TryParse(maxPlayersStr, out maxPlayers);
- new GUITextBlock(new Rectangle(columnX[1], 0, 0, 0), playerCount + "/" + maxPlayers, GUI.Style, serverFrame);
+ new GUITextBlock(new Rectangle(columnX[1], 0, 0, 0), playerCount + "/" + maxPlayers, "", Alignment.TopLeft, Alignment.CenterLeft, serverFrame);
- var gameStartedBox = new GUITickBox(new Rectangle(columnX[2] + (columnX[3] - columnX[2])/ 2, 0, 20, 20), "", Alignment.TopLeft, serverFrame);
+ var gameStartedBox = new GUITickBox(new Rectangle(columnX[2] + (columnX[3] - columnX[2])/ 2, 0, 20, 20), "", Alignment.CenterRight, serverFrame);
gameStartedBox.Selected = gameStarted == "1";
gameStartedBox.Enabled = false;
@@ -327,9 +325,7 @@ namespace Barotrauma
spriteBatch.Begin();
menu.Draw(spriteBatch);
-
- //if (previewPlayer!=null) previewPlayer.Draw(spriteBatch);
-
+
GUI.Draw((float)deltaTime, spriteBatch, null);
spriteBatch.End();
diff --git a/Subsurface/Source/Sprite.cs b/Subsurface/Source/Sprite.cs
index 236a7b102..4369d2dbc 100644
--- a/Subsurface/Source/Sprite.cs
+++ b/Subsurface/Source/Sprite.cs
@@ -300,6 +300,11 @@ namespace Barotrauma
}
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Color color)
+ {
+ DrawTiled(spriteBatch, pos, targetSize, startOffset, sourceRect, color);
+ }
+
+ public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Rectangle sourceRect, Color color)
{
//pos.X = (int)pos.X;
//pos.Y = (int)pos.Y;