diff --git a/Barotrauma/BarotraumaClient/Source/Map/Submarine.cs b/Barotrauma/BarotraumaClient/Source/Map/Submarine.cs index bccc223b4..8202dd7e8 100644 --- a/Barotrauma/BarotraumaClient/Source/Map/Submarine.cs +++ b/Barotrauma/BarotraumaClient/Source/Map/Submarine.cs @@ -146,7 +146,7 @@ namespace Barotrauma "", frame, GUI.SmallFont); new GUITextBlock(new Rectangle(246, 100, 100, 20), - TextManager.Get("RecommendedCrewExperience") + ": " + (string.IsNullOrEmpty(RecommendedCrewExperience) ? TextManager.Get("unknown") : RecommendedCrewExperience), + TextManager.Get("RecommendedCrewExperience") + ": " + (string.IsNullOrEmpty(RecommendedCrewExperience) ? TextManager.Get("unknown") : TextManager.Get(RecommendedCrewExperience)), "", frame, GUI.SmallFont); new GUITextBlock(new Rectangle(246, 120, 0, 20), diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs index b1bbb0131..267d08db7 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs @@ -15,9 +15,9 @@ namespace Barotrauma { private static string[] crewExperienceLevels = new string[] { - TextManager.Get("CrewExperienceLow"), - TextManager.Get("CrewExperienceMid"), - TextManager.Get("CrewExperienceHigh") + "CrewExperienceLow", + "CrewExperienceMid", + "CrewExperienceHigh" }; private Camera cam; @@ -587,23 +587,26 @@ namespace Barotrauma var toggleExpRight = new GUIButton(new Rectangle(350, y, 20, 20), ">", "", saveFrame); var experienceText = new GUITextBlock(new Rectangle(250, y, 100, 20), crewExperienceLevels[0], "", Alignment.TopLeft, Alignment.Center, saveFrame); + toggleExpLeft.OnClicked += (btn, userData) => { - int currentIndex = Array.IndexOf(crewExperienceLevels, experienceText.Text); + int currentIndex = Array.IndexOf(crewExperienceLevels, (string)experienceText.UserData); currentIndex--; if (currentIndex < 0) currentIndex = crewExperienceLevels.Length - 1; - experienceText.Text = crewExperienceLevels[currentIndex]; - Submarine.MainSub.RecommendedCrewExperience = experienceText.Text; + experienceText.UserData = crewExperienceLevels[currentIndex]; + experienceText.Text = TextManager.Get(crewExperienceLevels[currentIndex]); + Submarine.MainSub.RecommendedCrewExperience = (string)experienceText.UserData; return true; }; toggleExpRight.OnClicked += (btn, userData) => { - int currentIndex = Array.IndexOf(crewExperienceLevels, experienceText.Text); + int currentIndex = Array.IndexOf(crewExperienceLevels, (string)experienceText.UserData); currentIndex++; if (currentIndex >= crewExperienceLevels.Length) currentIndex = 0; - experienceText.Text = crewExperienceLevels[currentIndex]; - Submarine.MainSub.RecommendedCrewExperience = experienceText.Text; + experienceText.UserData = crewExperienceLevels[currentIndex]; + experienceText.Text = TextManager.Get(crewExperienceLevels[currentIndex]); + Submarine.MainSub.RecommendedCrewExperience = (string)experienceText.UserData; return true; }; @@ -613,8 +616,9 @@ namespace Barotrauma int max = Submarine.MainSub.RecommendedCrewSizeMax; crewSizeMin.IntValue = min; crewSizeMax.IntValue = max; - experienceText.Text = string.IsNullOrEmpty(Submarine.MainSub.RecommendedCrewExperience) ? + experienceText.UserData = string.IsNullOrEmpty(Submarine.MainSub.RecommendedCrewExperience) ? crewExperienceLevels[0] : Submarine.MainSub.RecommendedCrewExperience; + experienceText.Text = TextManager.Get((string)experienceText.UserData); } var saveButton = new GUIButton(new Rectangle(-90, 0, 80, 20), TextManager.Get("SaveSubButton"), Alignment.Right | Alignment.Bottom, "", saveFrame); diff --git a/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs index 40ee9d171..a38edae39 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs @@ -296,6 +296,15 @@ namespace Barotrauma RecommendedCrewSizeMin = doc.Root.GetAttributeInt("recommendedcrewsizemin", 0); RecommendedCrewSizeMax = doc.Root.GetAttributeInt("recommendedcrewsizemax", 0); RecommendedCrewExperience = doc.Root.GetAttributeString("recommendedcrewexperience", "Unknown"); + + //backwards compatibility (use text tags instead of the actual text) + if (RecommendedCrewExperience == "Beginner") + RecommendedCrewExperience = "CrewExperienceLow"; + else if (RecommendedCrewExperience == "Intermediate") + RecommendedCrewExperience = "CrewExperienceMid"; + else if (RecommendedCrewExperience == "Experienced") + RecommendedCrewExperience = "CrewExperienceHigh"; + string[] contentPackageNames = doc.Root.GetAttributeStringArray("compatiblecontentpackages", new string[0]); foreach (string contentPackageName in contentPackageNames) {