diff --git a/Barotrauma/BarotraumaClient/ClientCode.projitems b/Barotrauma/BarotraumaClient/ClientCode.projitems index 991ce2d39..e2df0a544 100644 --- a/Barotrauma/BarotraumaClient/ClientCode.projitems +++ b/Barotrauma/BarotraumaClient/ClientCode.projitems @@ -188,7 +188,6 @@ - diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs index 5d05c9d64..bc91fc8d4 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs @@ -166,7 +166,9 @@ 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 cc32e819a..f54b8d28f 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIStyle.cs @@ -12,10 +12,6 @@ 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; } @@ -87,26 +83,6 @@ 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 e8e7f7d0a..260e45a1d 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/LoadingScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/LoadingScreen.cs @@ -5,13 +5,12 @@ using System; using System.Collections.Generic; using System.Xml.Linq; using Barotrauma.Media; -using System.Linq; namespace Barotrauma { class LoadingScreen { - private Texture2D backgroundTexture; + private Texture2D backgroundTexture, monsterTexture, titleTexture; private RenderTarget2D renderTarget; @@ -44,7 +43,18 @@ 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 @@ -93,7 +103,7 @@ namespace Barotrauma try { DrawSplashScreen(spriteBatch); - if (SplashScreen != null && SplashScreen.IsPlaying) return; + if (SplashScreen!=null && SplashScreen.IsPlaying) return; } catch (Exception e) { @@ -101,27 +111,20 @@ 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); - float backgroundScale = GameMain.GraphicsHeight / 1500.0f; - float titleScale = MathHelper.SmoothStep(0.8f, 1.0f, state / 10.0f) * GameMain.GraphicsHeight / 1000.0f; + Scale = GameMain.GraphicsHeight / 1500.0f; state += deltaTime; if (DrawLoadingText) { - BackgroundPosition = new Vector2(GameMain.GraphicsWidth * 0.3f, GameMain.GraphicsHeight * 0.45f); - TitlePosition = new Vector2(GameMain.GraphicsWidth * 0.5f, GameMain.GraphicsHeight * 0.45f); + 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); } spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); @@ -129,10 +132,16 @@ 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), - backgroundScale * 1.5f, SpriteEffects.None, 0.2f); - - titleSprite?.Draw(spriteBatch, TitlePosition, Color.White * Math.Min((state - 1.0f) / 5.0f, 1.0f), scale: titleScale); - + 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); + spriteBatch.End(); graphics.SetRenderTarget(null); @@ -145,7 +154,9 @@ namespace Barotrauma spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); - titleSprite?.Draw(spriteBatch, TitlePosition, Color.White * Math.Min((state - 1.0f) / 5.0f, 1.0f), scale: titleScale); + 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); if (DrawLoadingText) { diff --git a/Barotrauma/BarotraumaClient/Source/GameSettings.cs b/Barotrauma/BarotraumaClient/Source/GameSettings.cs index 8658a7ba1..017a3e7e9 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSettings.cs @@ -139,16 +139,12 @@ namespace Barotrauma { string newLanguage = obj as string; if (newLanguage == Language) return true; - + + UnsavedSettings = true; Language = newLanguage; ApplySettings(); - 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; + new GUIMessageBox(TextManager.Get("RestartRequiredLabel"), TextManager.Get("RestartRequiredLanguage")); return true; }; diff --git a/Barotrauma/BarotraumaClient/Source/Program.cs b/Barotrauma/BarotraumaClient/Source/Program.cs index 37646cf3f..1fc149762 100644 --- a/Barotrauma/BarotraumaClient/Source/Program.cs +++ b/Barotrauma/BarotraumaClient/Source/Program.cs @@ -214,10 +214,6 @@ 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 76ac8bd4f..47b6ad26a 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, Credits = 11 } + public enum Tab { NewGame = 1, LoadGame = 2, HostServer = 3, Settings = 4, Tutorials = 5, JoinServer = 6, CharacterEditor = 7, SubmarineEditor = 8, QuickStartDev = 9, SteamWorkshop = 10 } private GUIComponent buttonsParent; @@ -34,27 +34,22 @@ 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.1f), AbsoluteOffset = new Point(-8, -8) }, + { RelativeOffset = new Vector2(0.05f, 0.05f), AbsoluteOffset = new Point(-5, -5) }, style: "TitleText") { Color = Color.Black * 0.5f, CanBeFocused = false }; - titleText = new GUIImage(new RectTransform(new Vector2(0.35f, 0.2f), Frame.RectTransform, Anchor.BottomRight) - { RelativeOffset = new Vector2(0.05f, 0.1f) }, + new GUIImage(new RectTransform(new Vector2(0.35f, 0.2f), Frame.RectTransform, Anchor.BottomRight) { RelativeOffset = new Vector2(0.05f, 0.05f) }, style: "TitleText"); - buttonsParent = new GUILayoutGroup(new RectTransform(new Vector2(0.3f, 0.85f), parent: Frame.RectTransform, anchor: Anchor.CenterLeft) + buttonsParent = new GUILayoutGroup(new RectTransform(new Vector2(0.3f, 0.85f), parent: Frame.RectTransform, anchor: Anchor.BottomLeft, pivot: Pivot.BottomLeft) { AbsoluteOffset = new Point(50, 0) }) @@ -227,7 +222,7 @@ namespace Barotrauma }; // === OPTION - var optionHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.8f), parent: buttonsParent.RectTransform), isHorizontal: true); + var optionHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.5f), parent: buttonsParent.RectTransform), isHorizontal: true); new GUIImage(new RectTransform(new Vector2(0.15f, 0.6f), optionHolder.RectTransform), "MainMenuOptionIcon") { @@ -237,9 +232,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.0f) }); + var optionButtons = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 1.0f), parent: optionHolder.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.05f) }); - var optionList = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 0.25f), parent: optionButtons.RectTransform)) + var optionList = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 0.3f), parent: optionButtons.RectTransform)) { Stretch = false, RelativeSpacing = 0.035f @@ -251,13 +246,6 @@ 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, @@ -266,9 +254,9 @@ namespace Barotrauma //debug button for quickly starting a new round #if DEBUG - new GUIButton(new RectTransform(new Point(300, 30), Frame.RectTransform, Anchor.TopRight) { AbsoluteOffset = new Point(40, 40) }, + new GUIButton(new RectTransform(new Vector2(0.8f, 0.1f), buttonsParent.RectTransform, Anchor.TopLeft, Pivot.BottomLeft) { AbsoluteOffset = new Point(0, -40) }, "Quickstart (dev)", style: "GUIButtonLarge", color: Color.Red) - { + { IgnoreLayoutGroups = true, UserData = Tab.QuickStartDev, OnClicked = (tb, userdata) => @@ -384,8 +372,6 @@ namespace Barotrauma { if (obj is Tab) { - titleText.Visible = true; - if (GameMain.Config.UnsavedSettings) { var applyBox = new GUIMessageBox( @@ -462,9 +448,6 @@ namespace Barotrauma if (!Steam.SteamManager.IsInitialized) return false; GameMain.SteamWorkshopScreen.Select(); break; - case Tab.Credits: - titleText.Visible = false; - break; } } else @@ -718,6 +701,11 @@ 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) @@ -789,30 +777,27 @@ namespace Barotrauma GUI.Font.DrawString(spriteBatch, "Barotrauma v" + GameMain.Version, new Vector2(10, GameMain.GraphicsHeight - 20), Color.White * 0.7f); #endif - if (selectedTab != Tab.Credits) + Vector2 textPos = new Vector2(GameMain.GraphicsWidth - 10, GameMain.GraphicsHeight - 10); + for (int i = legalCrap.Length - 1; i >= 0; i--) { - Vector2 textPos = new Vector2(GameMain.GraphicsWidth - 10, GameMain.GraphicsHeight - 10); - for (int i = legalCrap.Length - 1; i >= 0; i--) + 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 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) + GUI.DrawLine(spriteBatch, textPos, textPos - Vector2.UnitX * textSize.X, mouseOn ? Color.White : Color.White * 0.7f); + if (mouseOn && PlayerInput.LeftButtonClicked()) { - 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"); - } + 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 034faa046..f95891d81 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs @@ -1433,8 +1433,6 @@ 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 861005d58..a9ad8e446 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(separator); // Handling speaker index fetching, somehow doesn't work with the regex + string[] presplit = csvContent[i].Split(','); // 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(separator)); + list.Add(curr.TrimStart(',')); } return list.ToArray(); diff --git a/Barotrauma/BarotraumaClient/Source/Utils/ToolBox.cs b/Barotrauma/BarotraumaClient/Source/Utils/ToolBox.cs index 0a45900e2..6fff47dc9 100644 --- a/Barotrauma/BarotraumaClient/Source/Utils/ToolBox.cs +++ b/Barotrauma/BarotraumaClient/Source/Utils/ToolBox.cs @@ -107,42 +107,24 @@ namespace Barotrauma text = text.Replace("\n", " \n "); - List words = new List(); - string currWord = ""; - for (int i = 0; i < text.Length; i++) + string[] words; + if (TextManager.NoWhiteSpace) { - if (isCJK.IsMatch(text[i].ToString())) + words = new string[text.Length]; + for (int i = 0; i < text.Length; i++) { - 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]; + words[i] = text[i].ToString(); } } - if (currWord.Length > 0) + else { - words.Add(currWord); - currWord = ""; + words = text.Split(' '); } StringBuilder wrappedText = new StringBuilder(); float linePos = 0f; Vector2 spaceSize = font.MeasureString(" ") * textScale; - for (int i = 0; i < words.Count; ++i) + for (int i = 0; i < words.Length; ++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 4fc5e7569..f42bda821 100644 --- a/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml +++ b/Barotrauma/BarotraumaShared/Data/ContentPackages/Vanilla 0.9.xml @@ -73,6 +73,7 @@ + @@ -83,12 +84,8 @@ - - - - - - + + diff --git a/Barotrauma/BarotraumaShared/SharedContent.projitems b/Barotrauma/BarotraumaShared/SharedContent.projitems index 11f9c5171..8ac5b0f8f 100644 --- a/Barotrauma/BarotraumaShared/SharedContent.projitems +++ b/Barotrauma/BarotraumaShared/SharedContent.projitems @@ -361,12 +361,6 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - PreserveNewest @@ -505,25 +499,10 @@ PreserveNewest - + PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - + PreserveNewest @@ -577,9 +556,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest diff --git a/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs b/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs index 26059513f..064b5d1e2 100644 --- a/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs +++ b/Barotrauma/BarotraumaShared/Source/Sprite/Sprite.cs @@ -109,11 +109,6 @@ 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) @@ -245,12 +240,8 @@ namespace Barotrauma } if (SourceElement != null) { - sourceRect = SourceElement.GetAttributeRect("sourcerect", Rectangle.Empty); - var overrideElement = GetLocalizationOverrideElement(); - if (overrideElement != null && overrideElement.Attribute("sourcerect") != null) - { - sourceRect = overrideElement.GetAttributeRect("sourcerect", Rectangle.Empty); - } + Vector4 sourceVector = SourceElement.GetAttributeVector4("sourcerect", Vector4.Zero); + sourceRect = new Rectangle((int)sourceVector.X, (int)sourceVector.Y, (int)sourceVector.Z, (int)sourceVector.W); size = SourceElement.GetAttributeVector2("size", Vector2.One); size.X *= sourceRect.Width; size.Y *= sourceRect.Height; @@ -265,12 +256,6 @@ 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 == "") { @@ -288,22 +273,6 @@ 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 69f8a6d1d..466c12c65 100644 --- a/Barotrauma/BarotraumaShared/Source/TextManager.cs +++ b/Barotrauma/BarotraumaShared/Source/TextManager.cs @@ -16,6 +16,14 @@ 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 18b0170d8..a4105c57b 100644 --- a/Barotrauma/BarotraumaShared/Source/TextPack.cs +++ b/Barotrauma/BarotraumaShared/Source/TextPack.cs @@ -11,7 +11,9 @@ namespace Barotrauma public readonly string Language; private Dictionary> texts; - + + public readonly bool NoWhiteSpace; + private readonly string filePath; public TextPack(string filePath) @@ -23,6 +25,7 @@ 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 0963b9725..8451d5027 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 1faf47a55..ef9ff3d4b 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 751bb85a9..51d51cc70 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 45b257e88..8e7d2b59e 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 b11988da2..abeff1054 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 2f11785db..db200977b 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 2c29b9f4a..59dc7cc11 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 1123d84b8..2aef9a3bf 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 7fe946301..f06df8916 100644 Binary files a/Barotrauma/BarotraumaShared/Submarines/Venture.sub and b/Barotrauma/BarotraumaShared/Submarines/Venture.sub differ