- TextManager automatically replaces "\n" strings with a newline.

- Removed instantiating traitor start popup from client-side TraitorManager (instead the client receives the start message from the server).
- GUIMessageBoxes don't leave unnecessary empty space for the header if the header text is empty.
- More hard-coded text removal.
This commit is contained in:
Joonas Rikkonen
2017-12-27 16:07:00 +02:00
parent 4f0b190371
commit 3d73f28362
8 changed files with 95 additions and 105 deletions
@@ -43,6 +43,8 @@ namespace Barotrauma
: base(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
Color.Black * 0.5f, Alignment.TopLeft, null, parent)
{
int headerHeight = 30;
if (height == 0)
{
string wrappedText = ToolBox.WrapText(text, width, GUI.Font);
@@ -51,18 +53,18 @@ namespace Barotrauma
{
height += (int)GUI.Font.MeasureString(line).Y;
}
height += 220;
height += string.IsNullOrWhiteSpace(headerText) ? 220 : 220 - headerHeight;
}
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);
var header = new GUITextBlock(new Rectangle(0, 0, 0, headerHeight), headerText, null, null, textAlignment, "", frame, true);
GUI.Style.Apply(header, "", this);
if (!string.IsNullOrWhiteSpace(text))
{
var textBlock = new GUITextBlock(new Rectangle(0, 30, 0, height - 70), text,
var textBlock = new GUITextBlock(new Rectangle(0, string.IsNullOrWhiteSpace(headerText) ? 0 : headerHeight, 0, height - 70), text,
null, null, textAlignment, "", frame, true);
GUI.Style.Apply(textBlock, "", this);
}
@@ -1,12 +0,0 @@
namespace Barotrauma
{
partial class TraitorManager
{
public static void CreateStartPopUp(string targetName)
{
new GUIMessageBox("You are the Traitor!",
"Your secret task is to assassinate " + targetName + "! Discretion is an utmost concern; sinking the submarine and killing the entire crew "
+ "will arouse suspicion amongst the Fleet. If possible, make the death look like an accident.", 400, 350);
}
}
}
@@ -49,7 +49,7 @@ namespace Barotrauma
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, "", frame);
new GUITextBlock(new Rectangle(0, 0, 200, 20), TextManager.Get("FixHeader").Replace("[itemname]", item.Name), "", frame);
y = y + 40;
foreach (FixRequirement requirement in item.FixRequirements)
@@ -60,7 +60,7 @@ namespace Barotrauma
reqFrame.UserData = requirement;
var fixButton = new GUIButton(new Rectangle(0, 0, 50, 20), "Fix", "", reqFrame);
var fixButton = new GUIButton(new Rectangle(0, 0, 50, 20), TextManager.Get("Fix"), "", reqFrame);
fixButton.OnClicked = FixButtonPressed;
fixButton.UserData = requirement;
@@ -756,12 +756,7 @@ namespace Barotrauma.Networking
}
if (respawnAllowed) respawnManager = new RespawnManager(this, GameMain.NetLobbyScreen.UsingShuttle ? GameMain.NetLobbyScreen.SelectedShuttle : null);
if (isTraitor)
{
TraitorManager.CreateStartPopUp(traitorTargetName);
}
gameStarted = true;
GameMain.GameScreen.Select();