From dce643e1167074477092797a0a6233ef2c40204b Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Thu, 4 Apr 2019 11:09:03 +0300 Subject: [PATCH] (a135020e9) Fixed item assembly names and descriptions not being fetched from the text xml --- .../BarotraumaClient/Source/GameSettings.cs | 3 - .../Items/Components/Machines/Fabricator.cs | 8 - .../Source/Map/Lights/LightManager.cs | 5 - .../BarotraumaShared/Source/GameSettings.cs | 141 ++---------------- .../Items/Components/Signal/LightComponent.cs | 4 + .../Source/Map/ItemAssemblyPrefab.cs | 3 + 6 files changed, 16 insertions(+), 148 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/GameSettings.cs b/Barotrauma/BarotraumaClient/Source/GameSettings.cs index 0b3746ba4..b3d977283 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSettings.cs @@ -667,9 +667,6 @@ namespace Barotrauma //spacing new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null); - //spacing - new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null); - new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonArea.RectTransform, Anchor.BottomLeft), TextManager.Get("Cancel"), style: "GUIButtonLarge") { diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs index dafcff2a3..0a0491d5c 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Machines/Fabricator.cs @@ -290,11 +290,6 @@ namespace Barotrauma.Items.Components itemList.UpdateScrollBarSize(); itemList.BarScroll = 0.0f; - float requiredTime = user == null ? selectedItem.RequiredTime : GetRequiredTime(selectedItem, user); - string requiredTimeText = TextManager.Get("FabricatorRequiredTime") + ": " + ToolBox.SecondsToReadableTime(requiredTime); - new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedFrame.RectTransform), - requiredTimeText, textColor: ToolBox.GradientLerp(degreeOfSuccess, Color.Red, Color.Yellow, Color.LightGreen), font: GUI.SmallFont); - return true; } @@ -393,9 +388,6 @@ namespace Barotrauma.Items.Components itemList.UpdateScrollBarSize(); itemList.BarScroll = 0.0f; - float degreeOfSuccess = user == null ? 0.0f : DegreeOfSuccess(user, selectedItem.RequiredSkills); - if (degreeOfSuccess > 0.5f) { degreeOfSuccess = 1.0f; } - return true; } diff --git a/Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs b/Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs index a1fb2e137..49fa1d587 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Lights/LightManager.cs @@ -291,11 +291,6 @@ namespace Barotrauma.Lights spriteBatch.Draw(HighlightMap, Vector2.Zero, Color.White); spriteBatch.End(); } - GameMain.ParticleManager.Draw(spriteBatch, true, null, Particles.ParticleBlendState.Additive); - spriteBatch.End(); - - //draw a black rectangle on hulls to hide background lights behind subs - //--------------------------------------------------------------------------------------------------- //draw characters to obstruct the highlighted items/characters and light sprites //--------------------------------------------------------------------------------------------------- diff --git a/Barotrauma/BarotraumaShared/Source/GameSettings.cs b/Barotrauma/BarotraumaShared/Source/GameSettings.cs index 54c62eb4c..ae821f72d 100644 --- a/Barotrauma/BarotraumaShared/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSettings.cs @@ -401,6 +401,11 @@ namespace Barotrauma keyMapping[(int)InputType.Voice] = new KeyOrMouse(Keys.V); + keyMapping[(int)InputType.SelectNextCharacter] = new KeyOrMouse(Keys.Tab); + keyMapping[(int)InputType.SelectPreviousCharacter] = new KeyOrMouse(Keys.Q); + + keyMapping[(int)InputType.Voice] = new KeyOrMouse(Keys.V); + keyMapping[(int)InputType.Use] = new KeyOrMouse(0); keyMapping[(int)InputType.Aim] = new KeyOrMouse(1); @@ -459,64 +464,12 @@ namespace Barotrauma } } - List missingPackagePaths = new List(); - List incompatiblePackages = new List(); - foreach (XElement subElement in doc.Root.Elements()) + foreach (InputType inputType in Enum.GetValues(typeof(InputType))) { - switch (subElement.Name.ToString().ToLowerInvariant()) + if (keyMapping[(int)inputType] == null) { - case "contentpackage": - string path = System.IO.Path.GetFullPath(subElement.GetAttributeString("path", "")); - var matchingContentPackage = ContentPackage.List.Find(cp => System.IO.Path.GetFullPath(cp.Path) == path); - if (matchingContentPackage == null) - { - missingPackagePaths.Add(path); - } - else if (!matchingContentPackage.IsCompatible()) - { - incompatiblePackages.Add(matchingContentPackage); - } - else - { - SelectedContentPackages.Add(matchingContentPackage); - } - break; - } - } - - TextManager.LoadTextPacks(SelectedContentPackages); - - //display error messages after all content packages have been loaded - //to make sure the package that contains text files has been loaded before we attempt to use TextManager - foreach (string missingPackagePath in missingPackagePaths) - { - DebugConsole.ThrowError(TextManager.Get("ContentPackageNotFound").Replace("[packagepath]", missingPackagePath)); - } - foreach (ContentPackage incompatiblePackage in incompatiblePackages) - { - DebugConsole.ThrowError(TextManager.Get(incompatiblePackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage") - .Replace("[packagename]", incompatiblePackage.Name) - .Replace("[packageversion]", incompatiblePackage.GameVersion.ToString()) - .Replace("[gameversion]", GameMain.Version.ToString())); - } - foreach (ContentPackage contentPackage in SelectedContentPackages) - { - foreach (ContentFile file in contentPackage.Files) - { - if (!System.IO.File.Exists(file.Path)) - { - DebugConsole.ThrowError("Error in content package \"" + contentPackage.Name + "\" - file \"" + file.Path + "\" not found."); - continue; - } - ToolBox.IsProperFilenameCase(file.Path); - } - } - if (!SelectedContentPackages.Any()) - { - var availablePackage = ContentPackage.List.FirstOrDefault(cp => cp.IsCompatible() && cp.CorePackage); - if (availablePackage != null) - { - SelectedContentPackages.Add(availablePackage); + DebugConsole.ThrowError("Key binding for the input type \"" + inputType + " not set!"); + keyMapping[(int)inputType] = new KeyOrMouse(Keys.D1); } } @@ -525,82 +478,6 @@ namespace Barotrauma foreach (XElement subElement in doc.Root.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) - { - case "keymapping": - foreach (XAttribute attribute in subElement.Attributes()) - { - if (Enum.TryParse(attribute.Name.ToString(), true, out InputType inputType)) - { - if (int.TryParse(attribute.Value.ToString(), out int mouseButton)) - { - keyMapping[(int)inputType] = new KeyOrMouse(mouseButton); - } - else - { - if (Enum.TryParse(attribute.Value.ToString(), true, out Keys key)) - { - keyMapping[(int)inputType] = new KeyOrMouse(key); - } - } - } - } - break; - case "gameplay": - jobPreferences = new List(); - foreach (XElement ele in subElement.Element("jobpreferences").Elements("job")) - { - string jobIdentifier = ele.GetAttributeString("identifier", ""); - if (string.IsNullOrEmpty(jobIdentifier)) continue; - jobPreferences.Add(jobIdentifier); - } - break; - case "player": - defaultPlayerName = subElement.GetAttributeString("name", defaultPlayerName); - CharacterHeadIndex = subElement.GetAttributeInt("headindex", CharacterHeadIndex); - if (Enum.TryParse(subElement.GetAttributeString("gender", "none"), true, out Gender g)) - { - CharacterGender = g; - } - if (Enum.TryParse(subElement.GetAttributeString("race", "white"), true, out Race r)) - { - CharacterRace = r; - } - else - { - CharacterRace = Race.White; - } - CharacterHairIndex = subElement.GetAttributeInt("hairindex", CharacterHairIndex); - CharacterBeardIndex = subElement.GetAttributeInt("beardindex", CharacterBeardIndex); - CharacterMoustacheIndex = subElement.GetAttributeInt("moustacheindex", CharacterMoustacheIndex); - CharacterFaceAttachmentIndex = subElement.GetAttributeInt("faceattachmentindex", CharacterFaceAttachmentIndex); - break; - case "tutorials": - foreach (XElement tutorialElement in subElement.Elements()) - { - CompletedTutorialNames.Add(tutorialElement.GetAttributeString("name", "")); - } - break; - } - } - - UnsavedSettings = false; - - selectedContentPackagePaths = new HashSet(); - - foreach (XElement subElement in doc.Root.Elements()) - { - DebugConsole.ThrowError(TextManager.Get("ContentPackageNotFound").Replace("[packagepath]", missingPackagePath)); - } - foreach (ContentPackage incompatiblePackage in incompatiblePackages) - { - DebugConsole.ThrowError(TextManager.Get(incompatiblePackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage") - .Replace("[packagename]", incompatiblePackage.Name) - .Replace("[packageversion]", incompatiblePackage.GameVersion.ToString()) - .Replace("[gameversion]", GameMain.Version.ToString())); - } - foreach (ContentPackage contentPackage in SelectedContentPackages) - { - foreach (ContentFile file in contentPackage.Files) { case "contentpackage": string path = System.IO.Path.GetFullPath(subElement.GetAttributeString("path", "")); diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs index 7845f609c..eebf1146a 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/LightComponent.cs @@ -26,6 +26,10 @@ namespace Barotrauma.Items.Components private float blinkTimer; + private bool itemLoaded; + + private float blinkTimer; + public PhysicsBody ParentBody; [Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)] diff --git a/Barotrauma/BarotraumaShared/Source/Map/ItemAssemblyPrefab.cs b/Barotrauma/BarotraumaShared/Source/Map/ItemAssemblyPrefab.cs index 6dda14f5e..736acb775 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/ItemAssemblyPrefab.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/ItemAssemblyPrefab.cs @@ -38,6 +38,9 @@ namespace Barotrauma SerializableProperty.DeserializeProperties(this, configElement); + name = TextManager.Get("EntityName." + identifier, returnNull: true) ?? name; + Description = TextManager.Get("EntityDescription." + identifier, returnNull: true) ?? Description; + int minX = int.MaxValue, minY = int.MaxValue; int maxX = int.MinValue, maxY = int.MinValue; DisplayEntities = new List>();