Recommended crew experience is saved using text tags instead of the actual text (-> experience texts can be translated without the translation showing up in sub files).
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user