(262cb429c) More implementation

This commit is contained in:
Joonas Rikkonen
2019-06-04 15:33:16 +03:00
parent a3e67dd40a
commit 7babe75d18
8 changed files with 18 additions and 21 deletions
@@ -125,12 +125,12 @@ namespace Barotrauma
} }
else if (leavingSub.AtEndPosition) else if (leavingSub.AtEndPosition)
{ {
endRoundButton.Text = ToolBox.LimitString(TextManager.Get("EnterLocation").Replace("[locationname]", Map.SelectedLocation.Name), endRoundButton.Font, endRoundButton.Rect.Width - 5); endRoundButton.Text = ToolBox.LimitString(TextManager.GetWithVariable("EnterLocation", "[locationname]", Map.SelectedLocation.Name), endRoundButton.Font, endRoundButton.Rect.Width - 5);
endRoundButton.Visible = true; endRoundButton.Visible = true;
} }
else if (leavingSub.AtStartPosition) else if (leavingSub.AtStartPosition)
{ {
endRoundButton.Text = ToolBox.LimitString(TextManager.Get("EnterLocation").Replace("[locationname]", Map.CurrentLocation.Name), endRoundButton.Font, endRoundButton.Rect.Width - 5); endRoundButton.Text = ToolBox.LimitString(TextManager.GetWithVariable("EnterLocation", "[locationname]", Map.CurrentLocation.Name), endRoundButton.Font, endRoundButton.Rect.Width - 5);
endRoundButton.Visible = true; endRoundButton.Visible = true;
} }
else else
@@ -189,8 +189,8 @@ namespace Barotrauma
{ {
return; return;
} }
var msgBox = new GUIMessageBox("", TextManager.Get("CampaignEnterOutpostPrompt") var msgBox = new GUIMessageBox("", TextManager.GetWithVariable("CampaignEnterOutpostPrompt", "[locationname]",
.Replace("[locationname]", leavingSub.AtStartPosition ? Map.CurrentLocation.Name : Map.SelectedLocation.Name), leavingSub.AtStartPosition ? Map.CurrentLocation.Name : Map.SelectedLocation.Name),
new string[] { TextManager.Get("Yes"), TextManager.Get("No") }) new string[] { TextManager.Get("Yes"), TextManager.Get("No") })
{ {
UserData = "watchmanprompt" UserData = "watchmanprompt"
@@ -123,7 +123,7 @@ namespace Barotrauma
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), paddedFrame.RectTransform), Mission.Name, font: GUI.LargeFont); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), paddedFrame.RectTransform), Mission.Name, font: GUI.LargeFont);
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), paddedFrame.RectTransform), TextManager.Get("MissionReward").Replace("[reward]", Mission.Reward.ToString())); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), paddedFrame.RectTransform), TextManager.GetWithVariable("MissionReward", "[reward]", Mission.Reward.ToString()));
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedFrame.RectTransform), Mission.Description, wrap: true); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedFrame.RectTransform), Mission.Description, wrap: true);
} }
@@ -44,12 +44,9 @@ namespace Barotrauma
GUIListBox infoTextBox = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.7f), paddedFrame.RectTransform)); GUIListBox infoTextBox = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.7f), paddedFrame.RectTransform));
string summaryText = TextManager.Get(gameOver ? "RoundSummaryGameOver" : string summaryText = TextManager.GetWithVariables(gameOver ? "RoundSummaryGameOver" :
(progress ? "RoundSummaryProgress" : "RoundSummaryReturn")); (progress ? "RoundSummaryProgress" : "RoundSummaryReturn"), new string[2] { "[sub]", "[location]" },
new string[2] { Submarine.MainSub.Name, progress ? GameMain.GameSession.EndLocation.Name : GameMain.GameSession.StartLocation.Name });
summaryText = summaryText
.Replace("[sub]", Submarine.MainSub.Name)
.Replace("[location]", progress ? GameMain.GameSession.EndLocation.Name : GameMain.GameSession.StartLocation.Name);
var infoText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoTextBox.Content.RectTransform), var infoText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoTextBox.Content.RectTransform),
summaryText, wrap: true); summaryText, wrap: true);
@@ -79,7 +76,7 @@ namespace Barotrauma
if (GameMain.GameSession.Mission.Completed && singleplayer) if (GameMain.GameSession.Mission.Completed && singleplayer)
{ {
var missionReward = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoTextBox.Content.RectTransform), var missionReward = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoTextBox.Content.RectTransform),
TextManager.Get("MissionReward").Replace("[reward]", GameMain.GameSession.Mission.Reward.ToString())); TextManager.GetWithVariable("MissionReward", "[reward]", GameMain.GameSession.Mission.Reward.ToString()));
} }
} }
} }
@@ -110,7 +110,7 @@ namespace Barotrauma.Items.Components
if (child.UserData is Hull hull) if (child.UserData is Hull hull)
{ {
if (hull.Submarine == null || !hull.Submarine.IsOutpost) { continue; } if (hull.Submarine == null || !hull.Submarine.IsOutpost) { continue; }
string text = TextManager.Get("MiniMapOutpostDockingInfo").Replace("[outpost]", hull.Submarine.Name); string text = TextManager.GetWithVariable("MiniMapOutpostDockingInfo", "[outpost]", hull.Submarine.Name);
Vector2 textSize = GUI.Font.MeasureString(text); Vector2 textSize = GUI.Font.MeasureString(text);
Vector2 textPos = child.Center; Vector2 textPos = child.Center;
if (textPos.X + textSize.X / 2 > submarineContainer.Rect.Right) if (textPos.X + textSize.X / 2 > submarineContainer.Rect.Right)
@@ -290,9 +290,9 @@ namespace Barotrauma.Items.Components
noPowerTip = TextManager.Get("SteeringNoPowerTip"); noPowerTip = TextManager.Get("SteeringNoPowerTip");
autoPilotMaintainPosTip = TextManager.Get("SteeringAutoPilotMaintainPosTip"); autoPilotMaintainPosTip = TextManager.Get("SteeringAutoPilotMaintainPosTip");
autoPilotLevelStartTip = TextManager.Get("SteeringAutoPilotLocationTip").Replace("[locationname]", autoPilotLevelStartTip = TextManager.GetWithVariable("SteeringAutoPilotLocationTip", "[locationname]",
GameMain.GameSession?.StartLocation == null ? "Start" : GameMain.GameSession.StartLocation.Name); GameMain.GameSession?.StartLocation == null ? "Start" : GameMain.GameSession.StartLocation.Name);
autoPilotLevelEndTip = TextManager.Get("SteeringAutoPilotLocationTip").Replace("[locationname]", autoPilotLevelEndTip = TextManager.GetWithVariable("SteeringAutoPilotLocationTip", "[locationname]",
GameMain.GameSession?.EndLocation == null ? "End" : GameMain.GameSession.EndLocation.Name); GameMain.GameSession?.EndLocation == null ? "End" : GameMain.GameSession.EndLocation.Name);
steerArea = new GUICustomComponent(new RectTransform(new Point(viewSize), GuiFrame.RectTransform, Anchor.CenterLeft), steerArea = new GUICustomComponent(new RectTransform(new Point(viewSize), GuiFrame.RectTransform, Anchor.CenterLeft),
@@ -120,13 +120,13 @@ namespace Barotrauma.Items.Components
if (uiElements[i] is GUIButton button) if (uiElements[i] is GUIButton button)
{ {
button.Text = string.IsNullOrWhiteSpace(customInterfaceElementList[i].Label) ? button.Text = string.IsNullOrWhiteSpace(customInterfaceElementList[i].Label) ?
TextManager.Get("connection.signaloutx").Replace("[num]", (i + 1).ToString()) : TextManager.GetWithVariable("connection.signaloutx", "[num]", (i + 1).ToString()) :
customInterfaceElementList[i].Label; customInterfaceElementList[i].Label;
} }
else if (uiElements[i] is GUITickBox tickBox) else if (uiElements[i] is GUITickBox tickBox)
{ {
tickBox.Text = string.IsNullOrWhiteSpace(customInterfaceElementList[i].Label) ? tickBox.Text = string.IsNullOrWhiteSpace(customInterfaceElementList[i].Label) ?
TextManager.Get("connection.signaloutx").Replace("[num]", (i + 1).ToString()) : TextManager.GetWithVariable("connection.signaloutx", "[num]", (i + 1).ToString()) :
customInterfaceElementList[i].Label; customInterfaceElementList[i].Label;
} }
} }
@@ -721,7 +721,7 @@ namespace Barotrauma
var shadowSprite = GUI.Style.GetComponentStyle("OuterGlow").Sprites[GUIComponent.ComponentState.None][0]; var shadowSprite = GUI.Style.GetComponentStyle("OuterGlow").Sprites[GUIComponent.ComponentState.None][0];
string toolTip = mouseOnHealthInterface ? TextManager.Get("QuickUseAction.UseTreatment") : string toolTip = mouseOnHealthInterface ? TextManager.Get("QuickUseAction.UseTreatment") :
Character.Controlled.FocusedItem != null ? Character.Controlled.FocusedItem != null ?
TextManager.Get("PutItemIn").Replace("[itemname]", Character.Controlled.FocusedItem.Name) : TextManager.GetWithVariable("PutItemIn", "[itemname]", Character.Controlled.FocusedItem.Name, true) :
TextManager.Get("DropItem"); TextManager.Get("DropItem");
int textWidth = (int)Math.Max(GUI.Font.MeasureString(draggingItem.Name).X, GUI.SmallFont.MeasureString(toolTip).X); int textWidth = (int)Math.Max(GUI.Font.MeasureString(draggingItem.Name).X, GUI.SmallFont.MeasureString(toolTip).X);
int textSpacing = (int)(15 * GUI.Scale); int textSpacing = (int)(15 * GUI.Scale);
@@ -771,11 +771,11 @@ namespace Barotrauma
{ {
if (idJob == null) if (idJob == null)
{ {
description = TextManager.Get("IDCardName").Replace("[name]", idName); description = TextManager.GetWithVariable("IDCardName", "[name]", idName);
} }
else else
{ {
description = TextManager.Get("IDCardNameJob").Replace("[name]", idName).Replace("[job]", idJob); description = TextManager.GetWithVariables("IDCardNameJob", new string[2] { "[name]", "[job]" }, new string[2] { idName, idJob }, new bool[2] { false, true });
} }
if (!string.IsNullOrEmpty(item.Description)) if (!string.IsNullOrEmpty(item.Description))
{ {
@@ -754,7 +754,7 @@ namespace Barotrauma
itemInUseWarning.RectTransform.NonScaledSize = new Point(mergedHUDRect.Width, (int)(50 * GUI.Scale)); itemInUseWarning.RectTransform.NonScaledSize = new Point(mergedHUDRect.Width, (int)(50 * GUI.Scale));
if (itemInUseWarning.UserData != otherCharacter) if (itemInUseWarning.UserData != otherCharacter)
{ {
itemInUseWarning.Text = TextManager.Get("ItemInUse").Replace("[character]", otherCharacter.Name); itemInUseWarning.Text = TextManager.GetWithVariable("ItemInUse", "[character]", otherCharacter.Name);
itemInUseWarning.UserData = otherCharacter; itemInUseWarning.UserData = otherCharacter;
} }
break; break;