diff --git a/Barotrauma/BarotraumaClient/ClientCode.projitems b/Barotrauma/BarotraumaClient/ClientCode.projitems
index e2df0a544..991ce2d39 100644
--- a/Barotrauma/BarotraumaClient/ClientCode.projitems
+++ b/Barotrauma/BarotraumaClient/ClientCode.projitems
@@ -188,6 +188,7 @@
+
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs
index bc91fc8d4..5d05c9d64 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs
@@ -166,9 +166,7 @@ namespace Barotrauma
get { return enabled; }
set { enabled = value; }
}
-
- public bool TileSprites;
-
+
private static GUITextBlock toolTipBlock;
public Vector2 Center
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs
index f54b8d28f..cc32e819a 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs
@@ -12,6 +12,10 @@ namespace Barotrauma
private XElement configElement;
+ private GraphicsDevice graphicsDevice;
+
+ private ScalableFont defaultFont;
+
public ScalableFont Font { get; private set; }
public ScalableFont SmallFont { get; private set; }
public ScalableFont LargeFont { get; private set; }
@@ -83,6 +87,26 @@ namespace Barotrauma
}
}
+ ///
+ /// Returns the default font of the currently selected language
+ ///
+ public ScalableFont LoadCurrentDefaultFont()
+ {
+ defaultFont?.Dispose();
+ defaultFont = null;
+ foreach (XElement subElement in configElement.Elements())
+ {
+ switch (subElement.Name.ToString().ToLowerInvariant())
+ {
+ case "font":
+ defaultFont = LoadFont(subElement, graphicsDevice);
+ break;
+ }
+ }
+ return defaultFont;
+ }
+
+
private void RescaleFonts()
{
foreach (XElement subElement in configElement.Elements())
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/LoadingScreen.cs b/Barotrauma/BarotraumaClient/Source/GUI/LoadingScreen.cs
index 260e45a1d..e8e7f7d0a 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/LoadingScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/LoadingScreen.cs
@@ -5,12 +5,13 @@ using System;
using System.Collections.Generic;
using System.Xml.Linq;
using Barotrauma.Media;
+using System.Linq;
namespace Barotrauma
{
class LoadingScreen
{
- private Texture2D backgroundTexture, monsterTexture, titleTexture;
+ private Texture2D backgroundTexture;
private RenderTarget2D renderTarget;
@@ -43,18 +44,7 @@ namespace Barotrauma
private object loadMutex = new object();
private float? loadState;
-
- public Vector2 TitleSize
- {
- get { return new Vector2(titleTexture.Width, titleTexture.Height); }
- }
-
- public float Scale
- {
- get;
- private set;
- }
-
+
public float? LoadState
{
get
@@ -103,7 +93,7 @@ namespace Barotrauma
try
{
DrawSplashScreen(spriteBatch);
- if (SplashScreen!=null && SplashScreen.IsPlaying) return;
+ if (SplashScreen != null && SplashScreen.IsPlaying) return;
}
catch (Exception e)
{
@@ -111,20 +101,27 @@ namespace Barotrauma
GameMain.Config.EnableSplashScreen = false;
}
}
-
+
+ var titleStyle = GUI.Style?.GetComponentStyle("TitleText");
+ Sprite titleSprite = null;
+ if (titleStyle != null && titleStyle.Sprites.ContainsKey(GUIComponent.ComponentState.None))
+ {
+ titleSprite = titleStyle.Sprites[GUIComponent.ComponentState.None].First()?.Sprite;
+ }
+
drawn = true;
graphics.SetRenderTarget(renderTarget);
- Scale = GameMain.GraphicsHeight / 1500.0f;
+ float backgroundScale = GameMain.GraphicsHeight / 1500.0f;
+ float titleScale = MathHelper.SmoothStep(0.8f, 1.0f, state / 10.0f) * GameMain.GraphicsHeight / 1000.0f;
state += deltaTime;
if (DrawLoadingText)
{
- CenterPosition = new Vector2(GameMain.GraphicsWidth * 0.3f, GameMain.GraphicsHeight / 2.0f);
- TitlePosition = CenterPosition + new Vector2(-0.0f + (float)Math.Sqrt(state) * 220.0f, 0.0f) * Scale;
- TitlePosition.X = Math.Min(TitlePosition.X, (float)GameMain.GraphicsWidth / 2.0f);
+ BackgroundPosition = new Vector2(GameMain.GraphicsWidth * 0.3f, GameMain.GraphicsHeight * 0.45f);
+ TitlePosition = new Vector2(GameMain.GraphicsWidth * 0.5f, GameMain.GraphicsHeight * 0.45f);
}
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
@@ -132,16 +129,10 @@ namespace Barotrauma
spriteBatch.Draw(backgroundTexture, BackgroundPosition, null, Color.White * Math.Min(state / 5.0f, 1.0f), 0.0f,
new Vector2(backgroundTexture.Width / 2.0f, backgroundTexture.Height / 2.0f),
- Scale * 1.5f, SpriteEffects.None, 0.2f);
-
- spriteBatch.Draw(monsterTexture,
- CenterPosition + new Vector2((state % 40) * 100.0f - 1800.0f, (state % 40) * 30.0f - 200.0f) * Scale, null,
- Color.White, 0.0f, Vector2.Zero, Scale, SpriteEffects.None, 0.1f);
-
- spriteBatch.Draw(titleTexture,
- TitlePosition, null,
- Color.White * Math.Min((state - 1.0f) / 5.0f, 1.0f), 0.0f, new Vector2(titleTexture.Width / 2.0f, titleTexture.Height / 2.0f), Scale, SpriteEffects.None, 0.0f);
-
+ backgroundScale * 1.5f, SpriteEffects.None, 0.2f);
+
+ titleSprite?.Draw(spriteBatch, TitlePosition, Color.White * Math.Min((state - 1.0f) / 5.0f, 1.0f), scale: titleScale);
+
spriteBatch.End();
graphics.SetRenderTarget(null);
@@ -154,9 +145,7 @@ namespace Barotrauma
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
- spriteBatch.Draw(titleTexture,
- TitlePosition, null,
- Color.White * Math.Min((state - 3.0f) / 5.0f, 1.0f), 0.0f, new Vector2(titleTexture.Width / 2.0f, titleTexture.Height / 2.0f), Scale, SpriteEffects.None, 0.0f);
+ titleSprite?.Draw(spriteBatch, TitlePosition, Color.White * Math.Min((state - 1.0f) / 5.0f, 1.0f), scale: titleScale);
if (DrawLoadingText)
{
diff --git a/Barotrauma/BarotraumaClient/Source/GameSettings.cs b/Barotrauma/BarotraumaClient/Source/GameSettings.cs
index 017a3e7e9..8658a7ba1 100644
--- a/Barotrauma/BarotraumaClient/Source/GameSettings.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameSettings.cs
@@ -139,12 +139,16 @@ namespace Barotrauma
{
string newLanguage = obj as string;
if (newLanguage == Language) return true;
-
- UnsavedSettings = true;
+
Language = newLanguage;
ApplySettings();
- new GUIMessageBox(TextManager.Get("RestartRequiredLabel"), TextManager.Get("RestartRequiredLanguage"));
+ var msgBox = new GUIMessageBox(TextManager.Get("RestartRequiredLabel"), TextManager.Get("RestartRequiredLanguage"));
+ //change fonts to the default font of the new language to make sure
+ //they can be displayed when for example changing from English to Chinese
+ var defaultFont = GUI.Style.LoadCurrentDefaultFont();
+ msgBox.Header.Font = defaultFont;
+ msgBox.Text.Font = defaultFont;
return true;
};
diff --git a/Barotrauma/BarotraumaClient/Source/Program.cs b/Barotrauma/BarotraumaClient/Source/Program.cs
index 1fc149762..37646cf3f 100644
--- a/Barotrauma/BarotraumaClient/Source/Program.cs
+++ b/Barotrauma/BarotraumaClient/Source/Program.cs
@@ -214,6 +214,10 @@ namespace Barotrauma
sb.AppendLine("Level seed: " + ((Level.Loaded == null) ? "no level loaded" : Level.Loaded.Seed));
sb.AppendLine("Loaded submarine: " + ((Submarine.MainSub == null) ? "None" : Submarine.MainSub.Name + " (" + Submarine.MainSub.MD5Hash + ")"));
sb.AppendLine("Selected screen: " + (Screen.Selected == null ? "None" : Screen.Selected.ToString()));
+ if (SteamManager.IsInitialized)
+ {
+ sb.AppendLine("SteamManager initialized");
+ }
if (GameMain.Client != null)
{
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs
index 47b6ad26a..76ac8bd4f 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/MainMenuScreen.cs
@@ -14,7 +14,7 @@ namespace Barotrauma
{
class MainMenuScreen : Screen
{
- public enum Tab { NewGame = 1, LoadGame = 2, HostServer = 3, Settings = 4, Tutorials = 5, JoinServer = 6, CharacterEditor = 7, SubmarineEditor = 8, QuickStartDev = 9, SteamWorkshop = 10 }
+ public enum Tab { NewGame = 1, LoadGame = 2, HostServer = 3, Settings = 4, Tutorials = 5, JoinServer = 6, CharacterEditor = 7, SubmarineEditor = 8, QuickStartDev = 9, SteamWorkshop = 10, Credits = 11 }
private GUIComponent buttonsParent;
@@ -34,22 +34,27 @@ namespace Barotrauma
private Sprite backgroundSprite;
private Sprite backgroundVignette;
+ private GUIComponent titleText;
+
+ private CreditsPlayer creditsPlayer;
+
#region Creation
public MainMenuScreen(GameMain game)
{
backgroundVignette = new Sprite("Content/UI/MainMenuVignette.png", Vector2.Zero);
new GUIImage(new RectTransform(new Vector2(0.35f, 0.2f), Frame.RectTransform, Anchor.BottomRight)
- { RelativeOffset = new Vector2(0.05f, 0.05f), AbsoluteOffset = new Point(-5, -5) },
+ { RelativeOffset = new Vector2(0.05f, 0.1f), AbsoluteOffset = new Point(-8, -8) },
style: "TitleText")
{
Color = Color.Black * 0.5f,
CanBeFocused = false
};
- new GUIImage(new RectTransform(new Vector2(0.35f, 0.2f), Frame.RectTransform, Anchor.BottomRight) { RelativeOffset = new Vector2(0.05f, 0.05f) },
+ titleText = new GUIImage(new RectTransform(new Vector2(0.35f, 0.2f), Frame.RectTransform, Anchor.BottomRight)
+ { RelativeOffset = new Vector2(0.05f, 0.1f) },
style: "TitleText");
- buttonsParent = new GUILayoutGroup(new RectTransform(new Vector2(0.3f, 0.85f), parent: Frame.RectTransform, anchor: Anchor.BottomLeft, pivot: Pivot.BottomLeft)
+ buttonsParent = new GUILayoutGroup(new RectTransform(new Vector2(0.3f, 0.85f), parent: Frame.RectTransform, anchor: Anchor.CenterLeft)
{
AbsoluteOffset = new Point(50, 0)
})
@@ -222,7 +227,7 @@ namespace Barotrauma
};
// === OPTION
- var optionHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.5f), parent: buttonsParent.RectTransform), isHorizontal: true);
+ var optionHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.8f), parent: buttonsParent.RectTransform), isHorizontal: true);
new GUIImage(new RectTransform(new Vector2(0.15f, 0.6f), optionHolder.RectTransform), "MainMenuOptionIcon")
{
@@ -232,9 +237,9 @@ namespace Barotrauma
//spacing
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.0f), optionHolder.RectTransform), style: null);
- var optionButtons = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 1.0f), parent: optionHolder.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.05f) });
+ var optionButtons = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 1.0f), parent: optionHolder.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.0f) });
- var optionList = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 0.3f), parent: optionButtons.RectTransform))
+ var optionList = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 0.25f), parent: optionButtons.RectTransform))
{
Stretch = false,
RelativeSpacing = 0.035f
@@ -246,6 +251,13 @@ namespace Barotrauma
UserData = Tab.Settings,
OnClicked = SelectTab
};
+ //TODO: translate
+ new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), optionList.RectTransform), "Credits", textAlignment: Alignment.Left, style: "MainMenuGUIButton")
+ {
+ ForceUpperCase = true,
+ UserData = Tab.Credits,
+ OnClicked = SelectTab
+ };
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), optionList.RectTransform), TextManager.Get("QuitButton"), textAlignment: Alignment.Left, style: "MainMenuGUIButton")
{
ForceUpperCase = true,
@@ -254,9 +266,9 @@ namespace Barotrauma
//debug button for quickly starting a new round
#if DEBUG
- new GUIButton(new RectTransform(new Vector2(0.8f, 0.1f), buttonsParent.RectTransform, Anchor.TopLeft, Pivot.BottomLeft) { AbsoluteOffset = new Point(0, -40) },
+ new GUIButton(new RectTransform(new Point(300, 30), Frame.RectTransform, Anchor.TopRight) { AbsoluteOffset = new Point(40, 40) },
"Quickstart (dev)", style: "GUIButtonLarge", color: Color.Red)
- {
+ {
IgnoreLayoutGroups = true,
UserData = Tab.QuickStartDev,
OnClicked = (tb, userdata) =>
@@ -372,6 +384,8 @@ namespace Barotrauma
{
if (obj is Tab)
{
+ titleText.Visible = true;
+
if (GameMain.Config.UnsavedSettings)
{
var applyBox = new GUIMessageBox(
@@ -448,6 +462,9 @@ namespace Barotrauma
if (!Steam.SteamManager.IsInitialized) return false;
GameMain.SteamWorkshopScreen.Select();
break;
+ case Tab.Credits:
+ titleText.Visible = false;
+ break;
}
}
else
@@ -701,11 +718,6 @@ namespace Barotrauma
public override void Update(double 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);
#if !DEBUG
#if !OSX
if (Steam.SteamManager.USE_STEAM)
@@ -777,27 +789,30 @@ namespace Barotrauma
GUI.Font.DrawString(spriteBatch, "Barotrauma v" + GameMain.Version, new Vector2(10, GameMain.GraphicsHeight - 20), Color.White * 0.7f);
#endif
- Vector2 textPos = new Vector2(GameMain.GraphicsWidth - 10, GameMain.GraphicsHeight - 10);
- for (int i = legalCrap.Length - 1; i >= 0; i--)
+ if (selectedTab != Tab.Credits)
{
- Vector2 textSize = GUI.SmallFont.MeasureString(legalCrap[i]);
- bool mouseOn = i == 0 &&
- PlayerInput.MousePosition.X > textPos.X - textSize.X && PlayerInput.MousePosition.X < textPos.X &&
- PlayerInput.MousePosition.Y > textPos.Y - textSize.Y && PlayerInput.MousePosition.Y < textPos.Y;
-
- GUI.SmallFont.DrawString(spriteBatch,
- legalCrap[i], textPos - textSize,
- mouseOn ? Color.White : Color.White * 0.7f);
-
- if (i == 0)
+ Vector2 textPos = new Vector2(GameMain.GraphicsWidth - 10, GameMain.GraphicsHeight - 10);
+ for (int i = legalCrap.Length - 1; i >= 0; i--)
{
- GUI.DrawLine(spriteBatch, textPos, textPos - Vector2.UnitX * textSize.X, mouseOn ? Color.White : Color.White * 0.7f);
- if (mouseOn && PlayerInput.LeftButtonClicked())
+ Vector2 textSize = GUI.SmallFont.MeasureString(legalCrap[i]);
+ bool mouseOn = i == 0 &&
+ PlayerInput.MousePosition.X > textPos.X - textSize.X && PlayerInput.MousePosition.X < textPos.X &&
+ PlayerInput.MousePosition.Y > textPos.Y - textSize.Y && PlayerInput.MousePosition.Y < textPos.Y;
+
+ GUI.SmallFont.DrawString(spriteBatch,
+ legalCrap[i], textPos - textSize,
+ mouseOn ? Color.White : Color.White * 0.7f);
+
+ if (i == 0)
{
- Process.Start("http://privacypolicy.daedalic.com");
+ GUI.DrawLine(spriteBatch, textPos, textPos - Vector2.UnitX * textSize.X, mouseOn ? Color.White : Color.White * 0.7f);
+ if (mouseOn && PlayerInput.LeftButtonClicked())
+ {
+ Process.Start("http://privacypolicy.daedalic.com");
+ }
}
+ textPos.Y -= textSize.Y;
}
- textPos.Y -= textSize.Y;
}
spriteBatch.End();
diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs
index f95891d81..034faa046 100644
--- a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs
+++ b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs
@@ -1433,6 +1433,8 @@ namespace Barotrauma
selectedSub.Load(true);
Submarine.MainSub = selectedSub;
+ Submarine.MainSub.SetPrevTransform(Submarine.MainSub.Position);
+ Submarine.MainSub.UpdateTransform();
cam.Position = Submarine.MainSub.Position + Submarine.MainSub.HiddenSubPosition;
diff --git a/Barotrauma/BarotraumaClient/Source/Utils/LocalizationCSVtoXML.cs b/Barotrauma/BarotraumaClient/Source/Utils/LocalizationCSVtoXML.cs
index a9ad8e446..861005d58 100644
--- a/Barotrauma/BarotraumaClient/Source/Utils/LocalizationCSVtoXML.cs
+++ b/Barotrauma/BarotraumaClient/Source/Utils/LocalizationCSVtoXML.cs
@@ -11,7 +11,7 @@ namespace Barotrauma
{
private static Regex csvSplit = new Regex("(?:^|,)(\"(?:[^\"])*\"|[^,]*)", RegexOptions.Compiled); // Handling commas inside data fields surrounded by ""
private static List conversationClosingIndent = new List();
- private static char[] separator = new char[1] { ',' };
+ private static char[] separator = new char[1] { '|' };
private const string conversationsPath = "Content/NPCConversations";
private const string infoTextPath = "Content/Texts";
@@ -151,7 +151,7 @@ namespace Barotrauma
for (int i = traitStart + NPCPersonalityTrait.List.Count; i < csvContent.Length; i++) // Conversations
{
- string[] presplit = csvContent[i].Split(','); // Handling speaker index fetching, somehow doesn't work with the regex
+ string[] presplit = csvContent[i].Split(separator); // Handling speaker index fetching, somehow doesn't work with the regex
string[] split = SplitCSV(csvContent[i]);
int emptyFields = 0;
@@ -257,7 +257,7 @@ namespace Barotrauma
list.Add("");
}
- list.Add(curr.TrimStart(','));
+ list.Add(curr.TrimStart(separator));
}
return list.ToArray();
diff --git a/Barotrauma/BarotraumaClient/Source/Utils/ToolBox.cs b/Barotrauma/BarotraumaClient/Source/Utils/ToolBox.cs
index 6fff47dc9..0a45900e2 100644
--- a/Barotrauma/BarotraumaClient/Source/Utils/ToolBox.cs
+++ b/Barotrauma/BarotraumaClient/Source/Utils/ToolBox.cs
@@ -107,24 +107,42 @@ namespace Barotrauma
text = text.Replace("\n", " \n ");
- string[] words;
- if (TextManager.NoWhiteSpace)
+ List words = new List();
+ string currWord = "";
+ for (int i = 0; i < text.Length; i++)
{
- words = new string[text.Length];
- for (int i = 0; i < text.Length; i++)
+ if (isCJK.IsMatch(text[i].ToString()))
{
- words[i] = text[i].ToString();
+ if (currWord.Length > 0)
+ {
+ words.Add(currWord);
+ currWord = "";
+ }
+ words.Add(text[i].ToString());
+ }
+ else if (text[i] == ' ')
+ {
+ if (currWord.Length > 0)
+ {
+ words.Add(currWord);
+ currWord = "";
+ }
+ }
+ else
+ {
+ currWord += text[i];
}
}
- else
+ if (currWord.Length > 0)
{
- words = text.Split(' ');
+ words.Add(currWord);
+ currWord = "";
}
StringBuilder wrappedText = new StringBuilder();
float linePos = 0f;
Vector2 spaceSize = font.MeasureString(" ") * textScale;
- for (int i = 0; i < words.Length; ++i)
+ for (int i = 0; i < words.Count; ++i)
{
if (words[i].Length == 0)
{
diff --git a/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml b/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml
index f42bda821..096040964 100644
--- a/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml
+++ b/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml
@@ -84,8 +84,12 @@
-
-
+
+
+
+
+
+
diff --git a/Barotrauma/BarotraumaShared/SharedContent.projitems b/Barotrauma/BarotraumaShared/SharedContent.projitems
index 8ac5b0f8f..11f9c5171 100644
--- a/Barotrauma/BarotraumaShared/SharedContent.projitems
+++ b/Barotrauma/BarotraumaShared/SharedContent.projitems
@@ -361,6 +361,12 @@
PreserveNewest
+
+ PreserveNewest
+
+
+ PreserveNewest
+
PreserveNewest
@@ -499,10 +505,25 @@
PreserveNewest
-
+
PreserveNewest
-
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
PreserveNewest
@@ -556,6 +577,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
diff --git a/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs b/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs
index 064b5d1e2..26059513f 100644
--- a/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs
+++ b/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs
@@ -109,6 +109,11 @@ namespace Barotrauma
if (!ParseTexturePath(path, file)) { return; }
Name = SourceElement.GetAttributeString("name", null);
Vector4 sourceVector = SourceElement.GetAttributeVector4("sourcerect", Vector4.Zero);
+ var overrideElement = GetLocalizationOverrideElement();
+ if (overrideElement != null && overrideElement.Attribute("sourcerect") != null)
+ {
+ sourceVector = overrideElement.GetAttributeVector4("sourcerect", Vector4.Zero);
+ }
preMultipliedAlpha = preMultiplyAlpha ?? SourceElement.GetAttributeBool("premultiplyalpha", true);
bool shouldReturn = false;
if (!lazyLoad)
@@ -240,8 +245,12 @@ namespace Barotrauma
}
if (SourceElement != null)
{
- Vector4 sourceVector = SourceElement.GetAttributeVector4("sourcerect", Vector4.Zero);
- sourceRect = new Rectangle((int)sourceVector.X, (int)sourceVector.Y, (int)sourceVector.Z, (int)sourceVector.W);
+ sourceRect = SourceElement.GetAttributeRect("sourcerect", Rectangle.Empty);
+ var overrideElement = GetLocalizationOverrideElement();
+ if (overrideElement != null && overrideElement.Attribute("sourcerect") != null)
+ {
+ sourceRect = overrideElement.GetAttributeRect("sourcerect", Rectangle.Empty);
+ }
size = SourceElement.GetAttributeVector2("size", Vector2.One);
size.X *= sourceRect.Width;
size.Y *= sourceRect.Height;
@@ -256,6 +265,12 @@ namespace Barotrauma
if (file == "")
{
file = SourceElement.GetAttributeString("texture", "");
+ var overrideElement = GetLocalizationOverrideElement();
+ if (overrideElement != null)
+ {
+ string overrideFile = overrideElement.GetAttributeString("texture", "");
+ if (!string.IsNullOrEmpty(overrideFile)) { file = overrideFile; }
+ }
}
if (file == "")
{
@@ -273,6 +288,22 @@ namespace Barotrauma
}
return true;
}
+
+ private XElement GetLocalizationOverrideElement()
+ {
+ foreach (XElement subElement in SourceElement.Elements())
+ {
+ if (subElement.Name.ToString().ToLowerInvariant() == "override")
+ {
+ string language = subElement.GetAttributeString("language", "");
+ if (TextManager.Language.ToLower() == language.ToLower())
+ {
+ return subElement;
+ }
+ }
+ }
+ return null;
+ }
}
}
diff --git a/Barotrauma/BarotraumaShared/Source/TextManager.cs b/Barotrauma/BarotraumaShared/Source/TextManager.cs
index 466c12c65..69f8a6d1d 100644
--- a/Barotrauma/BarotraumaShared/Source/TextManager.cs
+++ b/Barotrauma/BarotraumaShared/Source/TextManager.cs
@@ -16,14 +16,6 @@ namespace Barotrauma
private static string[] serverMessageCharacters = new string[] { "~", "[", "]", "=" };
public static string Language;
- public static bool NoWhiteSpace
- {
- get
- {
- if (!textPacks.ContainsKey(Language)) { return false; }
- return textPacks[Language].Any(t => t.NoWhiteSpace);
- }
- }
private static HashSet availableLanguages = new HashSet();
public static IEnumerable AvailableLanguages
diff --git a/Barotrauma/BarotraumaShared/Source/TextPack.cs b/Barotrauma/BarotraumaShared/Source/TextPack.cs
index a4105c57b..18b0170d8 100644
--- a/Barotrauma/BarotraumaShared/Source/TextPack.cs
+++ b/Barotrauma/BarotraumaShared/Source/TextPack.cs
@@ -11,9 +11,7 @@ namespace Barotrauma
public readonly string Language;
private Dictionary> texts;
-
- public readonly bool NoWhiteSpace;
-
+
private readonly string filePath;
public TextPack(string filePath)
@@ -25,7 +23,6 @@ namespace Barotrauma
if (doc == null || doc.Root == null) return;
Language = doc.Root.GetAttributeString("language", "Unknown");
- NoWhiteSpace = doc.Root.GetAttributeBool("nowhitespace", false);
foreach (XElement subElement in doc.Root.Elements())
{
diff --git a/Barotrauma/BarotraumaShared/Submarines/Bunyip.sub b/Barotrauma/BarotraumaShared/Submarines/Bunyip.sub
index 8451d5027..0963b9725 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Bunyip.sub and b/Barotrauma/BarotraumaShared/Submarines/Bunyip.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Dugong.sub b/Barotrauma/BarotraumaShared/Submarines/Dugong.sub
index ef9ff3d4b..1faf47a55 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Dugong.sub and b/Barotrauma/BarotraumaShared/Submarines/Dugong.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Humpback.sub b/Barotrauma/BarotraumaShared/Submarines/Humpback.sub
index 51d51cc70..751bb85a9 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Humpback.sub and b/Barotrauma/BarotraumaShared/Submarines/Humpback.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Orca.sub b/Barotrauma/BarotraumaShared/Submarines/Orca.sub
index 8e7d2b59e..45b257e88 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Orca.sub and b/Barotrauma/BarotraumaShared/Submarines/Orca.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Remora.sub b/Barotrauma/BarotraumaShared/Submarines/Remora.sub
index abeff1054..b11988da2 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Remora.sub and b/Barotrauma/BarotraumaShared/Submarines/Remora.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub b/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub
index db200977b..2f11785db 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub and b/Barotrauma/BarotraumaShared/Submarines/RemoraDrone.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Selkie.sub b/Barotrauma/BarotraumaShared/Submarines/Selkie.sub
index 59dc7cc11..2c29b9f4a 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Selkie.sub and b/Barotrauma/BarotraumaShared/Submarines/Selkie.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Typhon.sub b/Barotrauma/BarotraumaShared/Submarines/Typhon.sub
index 2aef9a3bf..1123d84b8 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Typhon.sub and b/Barotrauma/BarotraumaShared/Submarines/Typhon.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Venture.sub b/Barotrauma/BarotraumaShared/Submarines/Venture.sub
index f06df8916..7fe946301 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Venture.sub and b/Barotrauma/BarotraumaShared/Submarines/Venture.sub differ