(38d8117f7) Added: More routing of TextManager.Get().Replace -> TextManager.GetWithVariable(s), missing workshop-related localization tags to englishvanilla

This commit is contained in:
Joonas Rikkonen
2019-06-04 15:38:12 +03:00
parent 822322e669
commit f797235bfd
66 changed files with 332 additions and 302 deletions
@@ -80,8 +80,8 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="GameAnalytics.Mono, Version=1.0.7018.15293, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="GameAnalytics.Mono, Version=1.0.6710.29255, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\GameAnalytics.Mono.dll</HintPath> <HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll</HintPath>
</Reference> </Reference>
<Reference Include="MonoGame.Framework, Version=3.7.1.189, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="MonoGame.Framework, Version=3.7.1.189, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\lib\net45\MonoGame.Framework.dll</HintPath> <HintPath>..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\lib\net45\MonoGame.Framework.dll</HintPath>
@@ -101,7 +101,7 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" /> <Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Data.SQLite, Version=1.0.102.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> <Reference Include="System.Data.SQLite, Version=1.0.102.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\System.Data.SQLite.dll</HintPath> <HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\System.Data.SQLite.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" /> <Reference Include="System.IO.Compression" />
@@ -351,12 +351,12 @@
<Import Project="..\BarotraumaShared\SharedCode.projitems" Label="Shared" /> <Import Project="..\BarotraumaShared\SharedCode.projitems" Label="Shared" />
<Import Project="..\BarotraumaShared\SharedContent.projitems" Label="Shared" /> <Import Project="..\BarotraumaShared\SharedContent.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets" Condition="Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets')" /> <Import Project="..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets" Condition="Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets'))" /> <Error Condition="!Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets'))" />
<Error Condition="!Exists('..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets'))" /> <Error Condition="!Exists('..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets'))" />
</Target> </Target>
<Import Project="..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets" Condition="Exists('..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets')" /> <Import Project="..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets" Condition="Exists('..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets')" />
+7 -8
View File
@@ -79,8 +79,8 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="GameAnalytics.Mono, Version=1.0.7018.15293, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="GameAnalytics.Mono, Version=1.0.6710.29255, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\GameAnalytics.Mono.dll</HintPath> <HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll</HintPath>
</Reference> </Reference>
<Reference Include="MonoGame.Framework, Version=3.7.1.189, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="MonoGame.Framework, Version=3.7.1.189, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\lib\net45\MonoGame.Framework.dll</HintPath> <HintPath>..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\lib\net45\MonoGame.Framework.dll</HintPath>
@@ -100,7 +100,7 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" /> <Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Data.SQLite, Version=1.0.102.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> <Reference Include="System.Data.SQLite, Version=1.0.102.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\System.Data.SQLite.dll</HintPath> <HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\System.Data.SQLite.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" /> <Reference Include="System.IO.Compression" />
@@ -271,12 +271,13 @@
<Import Project="..\BarotraumaShared\SharedCode.projitems" Label="Shared" /> <Import Project="..\BarotraumaShared\SharedCode.projitems" Label="Shared" />
<Import Project="..\BarotraumaShared\SharedContent.projitems" Label="Shared" /> <Import Project="..\BarotraumaShared\SharedContent.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets" Condition="Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets'))" />
<Error Condition="!Exists('..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets'))" /> <Error Condition="!Exists('..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets'))" />
<Error Condition="!Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets'))" />
</Target> </Target>
<Import Project="..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets" Condition="Exists('..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets')" /> <Import Project="..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets" Condition="Exists('..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.7.1.189\build\MonoGame.Framework.DesktopGL.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -287,10 +288,8 @@
<Target Name="AfterBuild"> <Target Name="AfterBuild">
<!-- Write version number to a "Version.txt" file in the output folder --> <!-- Write version number to a "Version.txt" file in the output folder -->
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)"> <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="CurrentAssembly" /> <Output TaskParameter="Assemblies" ItemName="CurrentAssembly" />
</GetAssemblyIdentity> </GetAssemblyIdentity>
<Exec Command="echo v%(CurrentAssembly.Version) &gt; $(TargetDir)Version.txt"> <Exec Command="echo v%(CurrentAssembly.Version) > $(TargetDir)Version.txt"></Exec>
</Exec>
</Target> </Target>
<Import Project="..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets" Condition="Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets')" />
</Project> </Project>
@@ -43,7 +43,7 @@ namespace Barotrauma
{ {
return text; return text;
} }
text = TextManager.Get(textTag).Replace("[key]", keyBind); text = TextManager.GetWithVariable(textTag, "[key]", keyBind);
cachedHudTexts.Add(textTag + keyBind, text); cachedHudTexts.Add(textTag + keyBind, text);
return text; return text;
} }
@@ -119,11 +119,9 @@ namespace Barotrauma
if ((int)newLevel > (int)prevLevel) if ((int)newLevel > (int)prevLevel)
{ {
GUI.AddMessage( GUI.AddMessage(
TextManager.Get("SkillIncreased") TextManager.GetWithVariables("SkillIncreased", new string[3] { "[name]", "[skillname]", "[newlevel]" },
.Replace("[name]", Name) new string[3] { Name, TextManager.Get("SkillName." + skillIdentifier), ((int)newLevel).ToString() },
.Replace("[skillname]", TextManager.Get("SkillName." + skillIdentifier)) new bool[3] { false, true, false }), Color.Green);
.Replace("[newlevel]", ((int)newLevel).ToString()),
Color.Green);
} }
} }
@@ -26,7 +26,7 @@ namespace Barotrauma
} }
else if (state != InfectionState.Active && Character.Controlled == character) else if (state != InfectionState.Active && Character.Controlled == character)
{ {
GUI.AddMessage(TextManager.Get("HuskActivate").Replace("[Attack]", GameMain.Config.KeyBind(InputType.Attack).ToString()), GUI.AddMessage(TextManager.GetWithVariable("HuskActivate", "[Attack]", GameMain.Config.KeyBind(InputType.Attack).ToString()),
Color.Red); Color.Red);
} }
} }
@@ -550,10 +550,8 @@ namespace Barotrauma
var exePaths = contentPackage.GetFilesOfType(ContentType.Executable); var exePaths = contentPackage.GetFilesOfType(ContentType.Executable);
if (exePaths.Any() && AppDomain.CurrentDomain.FriendlyName != exePaths.First()) if (exePaths.Any() && AppDomain.CurrentDomain.FriendlyName != exePaths.First())
{ {
var msgBox = new GUIMessageBox(TextManager.Get("Error"), var msgBox = new GUIMessageBox(TextManager.Get("Error"), TextManager.GetWithVariables("IncorrectExe",
TextManager.Get("IncorrectExe") new string[2] { "[selectedpackage]", "[exename]" }, new string[2] { contentPackage.Name, exePaths.First() }),
.Replace("[selectedpackage]", contentPackage.Name)
.Replace("[exename]", exePaths.First()),
new string[] { TextManager.Get("Yes"), TextManager.Get("No") }); new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
msgBox.Buttons[0].OnClicked += (_, userdata) => msgBox.Buttons[0].OnClicked += (_, userdata) =>
{ {
@@ -893,7 +891,7 @@ namespace Barotrauma
{ {
if (NetworkMember != null) NetworkMember.Disconnect(); if (NetworkMember != null) NetworkMember.Disconnect();
SteamManager.ShutDown(); SteamManager.ShutDown();
if (GameSettings.SendUserStatistics) GameAnalytics.OnQuit(); if (GameSettings.SendUserStatistics) GameAnalytics.OnStop();
base.OnExiting(sender, args); base.OnExiting(sender, args);
} }
} }
@@ -505,10 +505,7 @@ namespace Barotrauma
btn.OnClicked += (GUIButton button, object userData) => btn.OnClicked += (GUIButton button, object userData) =>
{ {
#if CLIENT if (Character.Controlled == null || Character.Controlled.SpeechImpediment >= 100.0f) return false;
if (GameMain.Client != null && Character.Controlled == null) { return false; }
#endif
if (Character.Controlled != null && Character.Controlled.SpeechImpediment >= 100.0f) { return false; }
if (btn.GetChildByUserData("selected").Visible) if (btn.GetChildByUserData("selected").Visible)
{ {
@@ -922,9 +919,7 @@ namespace Barotrauma
Font = GUI.SmallFont, Font = GUI.SmallFont,
OnClicked = (btn, userData) => OnClicked = (btn, userData) =>
{ {
#if CLIENT if (Character.Controlled == null) return false;
if (GameMain.Client != null && Character.Controlled == null) { return false; }
#endif
SetCharacterOrder(character, userData as Order, option, Character.Controlled); SetCharacterOrder(character, userData as Order, option, Character.Controlled);
orderTargetFrame = null; orderTargetFrame = null;
OrderOptionButtons.Clear(); OrderOptionButtons.Clear();
@@ -962,9 +957,7 @@ namespace Barotrauma
UserData = item == null ? order : new Order(order, item, item.Components.FirstOrDefault(ic => ic.GetType() == order.ItemComponentType)), UserData = item == null ? order : new Order(order, item, item.Components.FirstOrDefault(ic => ic.GetType() == order.ItemComponentType)),
OnClicked = (btn, userData) => OnClicked = (btn, userData) =>
{ {
#if CLIENT if (Character.Controlled == null) return false;
if (GameMain.Client != null && Character.Controlled == null) { return false; }
#endif
SetCharacterOrder(character, userData as Order, option, Character.Controlled); SetCharacterOrder(character, userData as Order, option, Character.Controlled);
orderTargetFrame = null; orderTargetFrame = null;
OrderOptionButtons.Clear(); OrderOptionButtons.Clear();
@@ -113,8 +113,8 @@ namespace Barotrauma
if (GameMain.Client != null && interactor == Character.Controlled) if (GameMain.Client != null && interactor == Character.Controlled)
{ {
var msgBox = new GUIMessageBox("", TextManager.Get("CampaignEnterOutpostPrompt") var msgBox = new GUIMessageBox("", TextManager.GetWithVariable("CampaignEnterOutpostPrompt", "[locationname]",
.Replace("[locationname]", Submarine.MainSub.AtStartPosition ? Map.CurrentLocation.Name : Map.SelectedLocation.Name), Submarine.MainSub.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"
@@ -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"
@@ -230,7 +230,7 @@ namespace Barotrauma.Tutorials
} while (!Submarine.MainSub.AtEndPosition || Submarine.MainSub.DockedTo.Count == 0); } while (!Submarine.MainSub.AtEndPosition || Submarine.MainSub.DockedTo.Count == 0);
RemoveCompletedObjective(segments[6]); RemoveCompletedObjective(segments[6]);
yield return new WaitForSeconds(3f, false); yield return new WaitForSeconds(3f, false);
GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.Get("Captain.Radio.Complete").Replace("[OUTPOSTNAME]", GameMain.GameSession.EndLocation.Name), ChatMessageType.Radio, null); GameMain.GameSession?.CrewManager.AddSinglePlayerChatMessage(radioSpeakerName, TextManager.GetWithVariable("Captain.Radio.Complete", "[OUTPOSTNAME]", GameMain.GameSession.EndLocation.Name), ChatMessageType.Radio, null);
SetHighlight(captain_navConsole.Item, false); SetHighlight(captain_navConsole.Item, false);
SetHighlight(captain_sonar.Item, false); SetHighlight(captain_sonar.Item, false);
SetHighlight(captain_statusMonitor, false); SetHighlight(captain_statusMonitor, false);
@@ -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,16 +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 });
int width = 760, height = 500;
GUIFrame innerFrame = new GUIFrame(new RectTransform(new Vector2(0.4f, 0.5f), frame.RectTransform, Anchor.Center, minSize: new Point(width, height)));
var paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), innerFrame.RectTransform, Anchor.Center))
{
Stretch = true,
RelativeSpacing = 0.03f
};
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);
@@ -83,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()));
} }
} }
} }
@@ -106,18 +106,15 @@ namespace Barotrauma
{ {
tickBox.TextColor = Color.Red; tickBox.TextColor = Color.Red;
tickBox.Enabled = false; tickBox.Enabled = false;
tickBox.ToolTip = TextManager.Get(contentPackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage") tickBox.ToolTip = TextManager.GetWithVariables(contentPackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage",
.Replace("[packagename]", contentPackage.Name) new string[3] { "[packagename]", "[packageversion]", "[gameversion]" }, new string[3] { contentPackage.Name, contentPackage.GameVersion.ToString(), GameMain.Version.ToString() });
.Replace("[packageversion]", contentPackage.GameVersion.ToString())
.Replace("[gameversion]", GameMain.Version.ToString());
} }
else if (contentPackage.CorePackage && !contentPackage.ContainsRequiredCorePackageFiles(out List<ContentType> missingContentTypes)) else if (contentPackage.CorePackage && !contentPackage.ContainsRequiredCorePackageFiles(out List<ContentType> missingContentTypes))
{ {
tickBox.TextColor = Color.Red; tickBox.TextColor = Color.Red;
tickBox.Enabled = false; tickBox.Enabled = false;
tickBox.ToolTip = TextManager.Get("ContentPackageMissingCoreFiles") tickBox.ToolTip = TextManager.GetWithVariables("ContentPackageMissingCoreFiles", new string[2] { "[packagename]", "[missingfiletypes]" },
.Replace("[packagename]", contentPackage.Name) new string[2] { contentPackage.Name, string.Join(", ", missingContentTypes) }, new bool[2] { false, true });
.Replace("[missingfiletypes]", string.Join(", ", missingContentTypes));
} }
} }
@@ -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;
@@ -127,7 +127,7 @@ namespace Barotrauma
if (!File.Exists(pathBox.Text)) if (!File.Exists(pathBox.Text))
{ {
new GUIMessageBox(TextManager.Get("Error"), TextManager.Get("ReloadLinkedSubError").Replace("[file]", pathBox.Text)); new GUIMessageBox(TextManager.Get("Error"), TextManager.GetWithVariable("ReloadLinkedSubError", "[file]", pathBox.Text));
pathBox.Flash(Color.Red); pathBox.Flash(Color.Red);
pathBox.Text = filePath; pathBox.Text = filePath;
return false; return false;
@@ -310,7 +310,7 @@ namespace Barotrauma
Vector2 realWorldDimensions = Dimensions * Physics.DisplayToRealWorldRatio; Vector2 realWorldDimensions = Dimensions * Physics.DisplayToRealWorldRatio;
if (realWorldDimensions != Vector2.Zero) if (realWorldDimensions != Vector2.Zero)
{ {
string dimensionsStr = TextManager.Get("DimensionsFormat").Replace("[width]", ((int)(realWorldDimensions.X)).ToString()).Replace("[height]", ((int)(realWorldDimensions.Y)).ToString()); string dimensionsStr = TextManager.GetWithVariables("DimensionsFormat", new string[2] { "[width]", "[height]" }, new string[2] { ((int)realWorldDimensions.X).ToString(), ((int)realWorldDimensions.Y).ToString() });
var dimensionsText = new GUITextBlock(new RectTransform(new Vector2(1, 0), descriptionBox.Content.RectTransform), var dimensionsText = new GUITextBlock(new RectTransform(new Vector2(1, 0), descriptionBox.Content.RectTransform),
TextManager.Get("Dimensions"), textAlignment: Alignment.TopLeft, font: GUI.Font, wrap: true) TextManager.Get("Dimensions"), textAlignment: Alignment.TopLeft, font: GUI.Font, wrap: true)
@@ -81,7 +81,7 @@ namespace Barotrauma.Networking
new GUITextBlock(new RectTransform(new Vector2(0.6f, 0.0f), paddedPlayerFrame.RectTransform), new GUITextBlock(new RectTransform(new Vector2(0.6f, 0.0f), paddedPlayerFrame.RectTransform),
bannedPlayer.ExpirationTime == null ? bannedPlayer.ExpirationTime == null ?
TextManager.Get("BanPermanent") : TextManager.Get("BanExpires").Replace("[time]", bannedPlayer.ExpirationTime.Value.ToString()), TextManager.Get("BanPermanent") : TextManager.GetWithVariable("BanExpires", "[time]", bannedPlayer.ExpirationTime.Value.ToString()),
font: GUI.SmallFont); font: GUI.SmallFont);
var reasonText = new GUITextBlock(new RectTransform(new Vector2(0.6f, 0.0f), paddedPlayerFrame.RectTransform), var reasonText = new GUITextBlock(new RectTransform(new Vector2(0.6f, 0.0f), paddedPlayerFrame.RectTransform),
@@ -269,7 +269,7 @@ namespace Barotrauma.Networking
catch catch
{ {
new GUIMessageBox(TextManager.Get("CouldNotConnectToServer"), new GUIMessageBox(TextManager.Get("CouldNotConnectToServer"),
TextManager.Get("InvalidIPAddress").Replace("[serverip]", serverIP).Replace("[port]", Port.ToString())); TextManager.GetWithVariables("InvalidIPAddress", new string[2] { "[serverip]", "[port]" }, new string[2] { serverIP, Port.ToString() }));
return; return;
} }
@@ -347,7 +347,7 @@ namespace Barotrauma.Networking
{ {
if (reconnectBox == null) if (reconnectBox == null)
{ {
reconnectBox = new GUIMessageBox(connectingText, TextManager.Get("ConnectingTo").Replace("[serverip]", serverIP), new string[] { TextManager.Get("Cancel") }); reconnectBox = new GUIMessageBox(connectingText, TextManager.GetWithVariable("ConnectingTo", "[serverip]", serverIP), new string[] { TextManager.Get("Cancel") });
reconnectBox.Buttons[0].OnClicked += (btn, userdata) => { CancelConnect(); return true; }; reconnectBox.Buttons[0].OnClicked += (btn, userdata) => { CancelConnect(); return true; };
reconnectBox.Buttons[0].OnClicked += reconnectBox.Close; reconnectBox.Buttons[0].OnClicked += reconnectBox.Close;
} }
@@ -667,7 +667,7 @@ namespace Barotrauma.Networking
string errorMsg = "Error while reading a message from server. {" + e + "}\n" + e.StackTrace; string errorMsg = "Error while reading a message from server. {" + e + "}\n" + e.StackTrace;
GameAnalyticsManager.AddErrorEventOnce("GameClient.Update:CheckServerMessagesException" + e.TargetSite.ToString(), GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); GameAnalyticsManager.AddErrorEventOnce("GameClient.Update:CheckServerMessagesException" + e.TargetSite.ToString(), GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
DebugConsole.ThrowError("Error while reading a message from server.", e); DebugConsole.ThrowError("Error while reading a message from server.", e);
new GUIMessageBox(TextManager.Get("Error"), TextManager.Get("MessageReadError").Replace("[message]", e.Message).Replace("[targetsite]", e.TargetSite.ToString())); new GUIMessageBox(TextManager.Get("Error"), TextManager.GetWithVariables("MessageReadError", new string[2] { "[message]", "[targetsite]" }, new string[2] { e.Message, e.TargetSite.ToString() }));
Disconnect(); Disconnect();
GameMain.MainMenuScreen.Select(); GameMain.MainMenuScreen.Select();
return; return;
@@ -1686,7 +1686,7 @@ namespace Barotrauma.Networking
switch (transfer.FileType) switch (transfer.FileType)
{ {
case FileTransferType.Submarine: case FileTransferType.Submarine:
new GUIMessageBox(TextManager.Get("ServerDownloadFinished"), TextManager.Get("FileDownloadedNotification").Replace("[filename]", transfer.FileName)); new GUIMessageBox(TextManager.Get("ServerDownloadFinished"), TextManager.GetWithVariable("FileDownloadedNotification", "[filename]", transfer.FileName));
var newSub = new Submarine(transfer.FilePath); var newSub = new Submarine(transfer.FilePath);
var existingSubs = Submarine.SavedSubmarines.Where(s => s.Name == newSub.Name && s.MD5Hash.Hash == newSub.MD5Hash.Hash).ToList(); var existingSubs = Submarine.SavedSubmarines.Where(s => s.Name == newSub.Name && s.MD5Hash.Hash == newSub.MD5Hash.Hash).ToList();
foreach (Submarine existingSub in existingSubs) foreach (Submarine existingSub in existingSubs)
@@ -2264,7 +2264,7 @@ namespace Barotrauma.Networking
GUI.DrawString(spriteBatch, GUI.DrawString(spriteBatch,
pos, pos,
ToolBox.LimitString(TextManager.Get("DownloadingFile").Replace("[filename]", transfer.FileName), GUI.SmallFont, (int)downloadBarSize.X), ToolBox.LimitString(TextManager.GetWithVariable("DownloadingFile", "[filename]", transfer.FileName), GUI.SmallFont, (int)downloadBarSize.X),
Color.White, null, 0, GUI.SmallFont); Color.White, null, 0, GUI.SmallFont);
GUI.DrawProgressBar(spriteBatch, new Vector2(pos.X, -pos.Y - downloadBarSize.Y / 2), new Vector2(downloadBarSize.X * 0.7f, downloadBarSize.Y / 2), transfer.Progress, Color.Green); GUI.DrawProgressBar(spriteBatch, new Vector2(pos.X, -pos.Y - downloadBarSize.Y / 2), new Vector2(downloadBarSize.X * 0.7f, downloadBarSize.Y / 2), transfer.Progress, Color.Green);
GUI.DrawString(spriteBatch, pos + new Vector2(5, downloadBarSize.Y / 2), GUI.DrawString(spriteBatch, pos + new Vector2(5, downloadBarSize.Y / 2),
@@ -2297,9 +2297,7 @@ namespace Barotrauma.Networking
} }
else else
{ {
string endVoteText = TextManager.Get("EndRoundVotes") string endVoteText = TextManager.GetWithVariables("EndRoundVotes", new string[2] { "[votes]", "[max]" }, new string[2] { EndVoteCount.ToString(), EndVoteMax.ToString() });
.Replace("[votes]", EndVoteCount.ToString())
.Replace("[max]", EndVoteMax.ToString());
GUI.DrawString(spriteBatch, EndVoteTickBox.Rect.Center.ToVector2() - GUI.SmallFont.MeasureString(endVoteText) / 2, GUI.DrawString(spriteBatch, EndVoteTickBox.Rect.Center.ToVector2() - GUI.SmallFont.MeasureString(endVoteText) / 2,
endVoteText, endVoteText,
Color.White, Color.White,
@@ -2317,14 +2315,13 @@ namespace Barotrauma.Networking
if (respawnManager.CurrentState == RespawnManager.State.Waiting && if (respawnManager.CurrentState == RespawnManager.State.Waiting &&
respawnManager.CountdownStarted) respawnManager.CountdownStarted)
{ {
respawnInfo = TextManager.Get(respawnManager.UsingShuttle ? "RespawnShuttleDispatching" : "RespawningIn"); respawnInfo = TextManager.GetWithVariable(respawnManager.UsingShuttle ? "RespawnShuttleDispatching" : "RespawningIn", "[time]", ToolBox.SecondsToReadableTime(respawnManager.RespawnTimer));
respawnInfo = respawnInfo.Replace("[time]", ToolBox.SecondsToReadableTime(respawnManager.RespawnTimer));
} }
else if (respawnManager.CurrentState == RespawnManager.State.Transporting) else if (respawnManager.CurrentState == RespawnManager.State.Transporting)
{ {
respawnInfo = respawnManager.TransportTimer <= 0.0f ? respawnInfo = respawnManager.TransportTimer <= 0.0f ?
"" : "" :
TextManager.Get("RespawnShuttleLeavingIn").Replace("[time]", ToolBox.SecondsToReadableTime(respawnManager.TransportTimer)); TextManager.GetWithVariable("RespawnShuttleLeavingIn", "[time]", ToolBox.SecondsToReadableTime(respawnManager.TransportTimer));
} }
if (respawnManager != null) if (respawnManager != null)
@@ -203,23 +203,20 @@ namespace Barotrauma.Networking
if (ContentPackage.List.Any(cp => cp.MD5hash.Hash == ContentPackageHashes[i])) if (ContentPackage.List.Any(cp => cp.MD5hash.Hash == ContentPackageHashes[i]))
{ {
packageText.TextColor = Color.Orange; packageText.TextColor = Color.Orange;
packageText.ToolTip = TextManager.Get("ServerListContentPackageNotEnabled") packageText.ToolTip = TextManager.GetWithVariable("ServerListContentPackageNotEnabled", "[contentpackage]", ContentPackageNames[i]);
.Replace("[contentpackage]", ContentPackageNames[i]);
} }
//workshop download link found //workshop download link found
else if (i < ContentPackageWorkshopUrls.Count && !string.IsNullOrEmpty(ContentPackageWorkshopUrls[i])) else if (i < ContentPackageWorkshopUrls.Count && !string.IsNullOrEmpty(ContentPackageWorkshopUrls[i]))
{ {
availableWorkshopUrls.Add(ContentPackageWorkshopUrls[i]); availableWorkshopUrls.Add(ContentPackageWorkshopUrls[i]);
packageText.TextColor = Color.Yellow; packageText.TextColor = Color.Yellow;
packageText.ToolTip = TextManager.Get("ServerListIncompatibleContentPackageWorkshopAvailable") packageText.ToolTip = TextManager.GetWithVariable("ServerListIncompatibleContentPackageWorkshopAvailable", "[contentpackage]", ContentPackageNames[i]);
.Replace("[contentpackage]", ContentPackageNames[i]);
} }
else //no package or workshop download link found, tough luck else //no package or workshop download link found, tough luck
{ {
packageText.TextColor = Color.Red; packageText.TextColor = Color.Red;
packageText.ToolTip = TextManager.Get("ServerListIncompatibleContentPackage") packageText.ToolTip = TextManager.GetWithVariables("ServerListIncompatibleContentPackage",
.Replace("[contentpackage]", ContentPackageNames[i]) new string[2] { "[contentpackage]", "[hash]" }, new string[2] { ContentPackageNames[i], ContentPackageHashes[i] });
.Replace("[hash]", ContentPackageHashes[i]);
} }
} }
} }
@@ -465,7 +465,6 @@ namespace Barotrauma.Networking
return true; return true;
}; };
InitMonstersEnabled();
List<string> monsterNames = MonsterEnabled.Keys.ToList(); List<string> monsterNames = MonsterEnabled.Keys.ToList();
tempMonsterEnabled = new Dictionary<string, bool>(MonsterEnabled); tempMonsterEnabled = new Dictionary<string, bool>(MonsterEnabled);
foreach (string s in monsterNames) foreach (string s in monsterNames)
@@ -596,7 +596,7 @@ namespace Barotrauma.Steam
{ {
if (!item.Installed) if (!item.Installed)
{ {
errorMsg = TextManager.Get("WorkshopErrorInstallRequiredToEnable").Replace("[itemname]", item.Title); errorMsg = TextManager.GetWithVariable("WorkshopErrorInstallRequiredToEnable", "[itemname]", item.Title);
DebugConsole.NewMessage(errorMsg, Microsoft.Xna.Framework.Color.Red); DebugConsole.NewMessage(errorMsg, Microsoft.Xna.Framework.Color.Red);
return false; return false;
} }
@@ -607,18 +607,15 @@ namespace Barotrauma.Steam
if (!contentPackage.IsCompatible()) if (!contentPackage.IsCompatible())
{ {
errorMsg = TextManager.Get(contentPackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage") errorMsg = TextManager.GetWithVariables(contentPackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage",
.Replace("[packagename]", contentPackage.Name) new string[3] { "[packagename]", "[packageversion]", "[gameversion]" }, new string[3] { contentPackage.Name, contentPackage.GameVersion.ToString(), GameMain.Version.ToString() });
.Replace("[packageversion]", contentPackage.GameVersion.ToString())
.Replace("[gameversion]", GameMain.Version.ToString());
return false; return false;
} }
if (contentPackage.CorePackage && !contentPackage.ContainsRequiredCorePackageFiles(out List<ContentType> missingContentTypes)) if (contentPackage.CorePackage && !contentPackage.ContainsRequiredCorePackageFiles(out List<ContentType> missingContentTypes))
{ {
errorMsg = TextManager.Get("ContentPackageMissingCoreFiles") errorMsg = TextManager.GetWithVariables("ContentPackageMissingCoreFiles", new string[2] { "[packagename]", "[missingfiletypes]" },
.Replace("[packagename]", contentPackage.Name) new string[2] { contentPackage.Name, string.Join(", ", missingContentTypes) }, new bool[2] { false, true });
.Replace("[missingfiletypes]", string.Join(", ", missingContentTypes));
return false; return false;
} }
@@ -640,9 +637,7 @@ namespace Barotrauma.Steam
{ {
if (File.Exists(newContentPackagePath) && !CheckFileEquality(newContentPackagePath, metaDataFilePath)) if (File.Exists(newContentPackagePath) && !CheckFileEquality(newContentPackagePath, metaDataFilePath))
{ {
errorMsg = TextManager.Get("WorkshopErrorOverwriteOnEnable") errorMsg = TextManager.GetWithVariables("WorkshopErrorOverwriteOnEnable", new string[2] { "[itemname]", "[filename]" }, new string[2] { item.Title, newContentPackagePath });
.Replace("[itemname]", item.Title)
.Replace("[filename]", newContentPackagePath);
DebugConsole.NewMessage(errorMsg, Microsoft.Xna.Framework.Color.Red); DebugConsole.NewMessage(errorMsg, Microsoft.Xna.Framework.Color.Red);
return false; return false;
} }
@@ -652,9 +647,7 @@ namespace Barotrauma.Steam
string sourceFile = Path.Combine(item.Directory.FullName, contentFile.Path); string sourceFile = Path.Combine(item.Directory.FullName, contentFile.Path);
if (File.Exists(sourceFile) && File.Exists(contentFile.Path) && !CheckFileEquality(sourceFile, contentFile.Path)) if (File.Exists(sourceFile) && File.Exists(contentFile.Path) && !CheckFileEquality(sourceFile, contentFile.Path))
{ {
errorMsg = TextManager.Get("WorkshopErrorOverwriteOnEnable") errorMsg = TextManager.GetWithVariables("WorkshopErrorOverwriteOnEnable", new string[2] { "[itemname]", "[filename]" }, new string[2] { item.Title, contentFile.Path });
.Replace("[itemname]", item.Title)
.Replace("[filename]", contentFile.Path);
DebugConsole.NewMessage(errorMsg, Microsoft.Xna.Framework.Color.Red); DebugConsole.NewMessage(errorMsg, Microsoft.Xna.Framework.Color.Red);
return false; return false;
} }
@@ -673,15 +666,14 @@ namespace Barotrauma.Steam
//the content package is trying to copy a file to a prohibited path, which is not allowed //the content package is trying to copy a file to a prohibited path, which is not allowed
if (File.Exists(sourceFile)) if (File.Exists(sourceFile))
{ {
errorMsg = TextManager.Get("WorkshopErrorIllegalPathOnEnable").Replace("[filename]", contentFile.Path); errorMsg = TextManager.GetWithVariable("WorkshopErrorIllegalPathOnEnable", "[filename]", contentFile.Path);
return false; return false;
} }
//not trying to copy anything, so this is a reference to an external file //not trying to copy anything, so this is a reference to an external file
//if the external file doesn't exist, we cannot enable the package //if the external file doesn't exist, we cannot enable the package
else if (!File.Exists(contentFile.Path)) else if (!File.Exists(contentFile.Path))
{ {
//TODO: add the error message to localization errorMsg = TextManager.GetWithVariable("WorkshopErrorEnableFailed", "[itemname]", item.Title) + " " + TextManager.GetWithVariable("WorkshopFileNotFound", "[path]", "\"" + contentFile.Path + "\"");
errorMsg = TextManager.Get("WorkshopErrorEnableFailed").Replace("[itemname]", item.Title) + " {File \"" + contentFile.Path + "\" not found.}";
return false; return false;
} }
continue; continue;
@@ -696,8 +688,7 @@ namespace Barotrauma.Steam
else else
{ {
//file not present in either the mod or the game folder -> cannot enable the package //file not present in either the mod or the game folder -> cannot enable the package
//TODO: add the error message to localization errorMsg = TextManager.GetWithVariable("WorkshopErrorEnableFailed", "[itemname]", item.Title) + " " + TextManager.GetWithVariable("WorkshopFileNotFound", "[path]", "\"" + contentFile.Path + "\"");
errorMsg = TextManager.Get("WorkshopErrorEnableFailed").Replace("[itemname]", item.Title) + " {File \"" + contentFile.Path + "\" not found.}";
return false; return false;
} }
} }
@@ -713,7 +704,7 @@ namespace Barotrauma.Steam
if (!File.Exists(sourceFile)) { continue; } if (!File.Exists(sourceFile)) { continue; }
if (!ContentPackage.IsModFilePathAllowed(nonContentFile)) if (!ContentPackage.IsModFilePathAllowed(nonContentFile))
{ {
DebugConsole.ThrowError(TextManager.Get("WorkshopErrorIllegalPathOnEnable").Replace("[filename]", nonContentFile)); DebugConsole.ThrowError(TextManager.GetWithVariable("WorkshopErrorIllegalPathOnEnable", "[filename]", nonContentFile));
continue; continue;
} }
Directory.CreateDirectory(Path.GetDirectoryName(nonContentFile)); Directory.CreateDirectory(Path.GetDirectoryName(nonContentFile));
@@ -722,7 +713,7 @@ namespace Barotrauma.Steam
} }
catch (Exception e) catch (Exception e)
{ {
errorMsg = TextManager.Get("WorkshopErrorEnableFailed").Replace("[itemname]", item.Title) + " {" + e.Message + "}"; errorMsg = TextManager.GetWithVariable("WorkshopErrorEnableFailed", "[itemname]", item.Title) + " {" + e.Message + "}";
DebugConsole.NewMessage(errorMsg, Microsoft.Xna.Framework.Color.Red); DebugConsole.NewMessage(errorMsg, Microsoft.Xna.Framework.Color.Red);
return false; return false;
} }
@@ -937,11 +928,11 @@ namespace Barotrauma.Steam
DebugConsole.ThrowError(errorMsg); DebugConsole.ThrowError(errorMsg);
new GUIMessageBox( new GUIMessageBox(
TextManager.Get("Error"), TextManager.Get("Error"),
TextManager.Get("WorkshopItemUpdateFailed").Replace("[itemname]", item.Title).Replace("[errormessage]", errorMsg)); TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { item.Title, errorMsg }));
} }
else else
{ {
new GUIMessageBox("", TextManager.Get("WorkshopItemUpdated").Replace("[itemname]", item.Title)); new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", item.Title));
itemsUpdated = true; itemsUpdated = true;
} }
} }
@@ -121,8 +121,7 @@ namespace Barotrauma
if (!hasRequiredContentPackages) if (!hasRequiredContentPackages)
{ {
var msgBox = new GUIMessageBox(TextManager.Get("ContentPackageMismatch"), var msgBox = new GUIMessageBox(TextManager.Get("ContentPackageMismatch"),
TextManager.Get("ContentPackageMismatchWarning") TextManager.GetWithVariable("ContentPackageMismatchWarning", "[requiredcontentpackages]", string.Join(", ", selectedSub.RequiredContentPackages)),
.Replace("[requiredcontentpackages]", string.Join(", ", selectedSub.RequiredContentPackages)),
new string[] { TextManager.Get("Yes"), TextManager.Get("No") }); new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
msgBox.Buttons[0].OnClicked = msgBox.Close; msgBox.Buttons[0].OnClicked = msgBox.Close;
@@ -636,7 +636,7 @@ namespace Barotrauma
CanBeFocused = false CanBeFocused = false
}; };
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), container.RectTransform), new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), container.RectTransform),
TextManager.Get("Reward").Replace("[reward]", selectedMission.Reward.ToString())) TextManager.GetWithVariable("Reward", "[reward]", selectedMission.Reward.ToString()))
{ {
CanBeFocused = false CanBeFocused = false
}; };
@@ -860,8 +860,7 @@ namespace Barotrauma
public string GetMoney() public string GetMoney()
{ {
return TextManager.Get("PlayerCredits").Replace("[credits]", return TextManager.GetWithVariable("PlayerCredits", "[credits]", (GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", Campaign.Money));
((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", Campaign.Money)));
} }
private bool SelectCharacter(GUIComponent component, object selection) private bool SelectCharacter(GUIComponent component, object selection)
@@ -902,7 +901,7 @@ namespace Barotrauma
{ {
var confirmDialog = new GUIMessageBox( var confirmDialog = new GUIMessageBox(
TextManager.Get("FireWarningHeader"), TextManager.Get("FireWarningHeader"),
TextManager.Get("FireWarningText").Replace("[charactername]", ((CharacterInfo)obj).Name), TextManager.GetWithVariable("FireWarningText", "[charactername]", ((CharacterInfo)obj).Name),
new string[] { TextManager.Get("Yes"), TextManager.Get("No") }); new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
confirmDialog.Buttons[0].UserData = (CharacterInfo)obj; confirmDialog.Buttons[0].UserData = (CharacterInfo)obj;
confirmDialog.Buttons[0].OnClicked = FireCharacter; confirmDialog.Buttons[0].OnClicked = FireCharacter;
@@ -9,6 +9,7 @@ namespace Barotrauma
private GUIListBox listBox; private GUIListBox listBox;
private XElement configElement; private XElement configElement;
private RectTransform parent;
private float scrollSpeed; private float scrollSpeed;
@@ -277,7 +277,7 @@ namespace Barotrauma
Stretch = true Stretch = true
}; };
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.4f), commonnessContainer.RectTransform), new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.4f), commonnessContainer.RectTransform),
TextManager.Get("LevelEditorLevelObjCommonness").Replace("[leveltype]", selectedParams.Name), textAlignment: Alignment.Center); TextManager.GetWithVariable("LevelEditorLevelObjCommonness", "[leveltype]", selectedParams.Name), textAlignment: Alignment.Center);
new GUINumberInput(new RectTransform(new Vector2(0.5f, 0.4f), commonnessContainer.RectTransform), GUINumberInput.NumberType.Float) new GUINumberInput(new RectTransform(new Vector2(0.5f, 0.4f), commonnessContainer.RectTransform), GUINumberInput.NumberType.Float)
{ {
MinValueFloat = 0, MinValueFloat = 0,
@@ -1986,16 +1986,17 @@ namespace Barotrauma
string errorMsg = ""; string errorMsg = "";
if (sub == null) if (sub == null)
{ {
errorMsg = TextManager.Get("SubNotFoundError").Replace("[subname]", subName) + " "; errorMsg = TextManager.GetWithVariable("SubNotFoundError", "[subname]", subName) + " ";
} }
else if (sub.MD5Hash.Hash == null) else if (sub.MD5Hash.Hash == null)
{ {
errorMsg = TextManager.Get("SubLoadError").Replace("[subname]", subName) + " "; errorMsg = TextManager.GetWithVariable("SubLoadError", "[subname]", subName) + " ";
if (matchingListSub != null) matchingListSub.GetChild<GUITextBox>().TextColor = Color.Red; if (matchingListSub != null) matchingListSub.GetChild<GUITextBox>().TextColor = Color.Red;
} }
else else
{ {
errorMsg = TextManager.Get("SubDoesntMatchError").Replace("[subname]", sub.Name).Replace("[myhash]", sub.MD5Hash.ShortHash).Replace("[serverhash]", Md5Hash.GetShortHash(md5Hash)) + " "; errorMsg = TextManager.GetWithVariables("SubDoesntMatchError", new string[3] { "[subname]" , "[myhash]", "[serverhash]" },
new string[3] { sub.Name, sub.MD5Hash.ShortHash, Md5Hash.GetShortHash(md5Hash) }) + " ";
} }
errorMsg += TextManager.Get("DownloadSubQuestion"); errorMsg += TextManager.Get("DownloadSubQuestion");
@@ -217,6 +217,22 @@ namespace Barotrauma
return true; return true;
} }
private bool RefreshJoinButtonState(GUIComponent component, object obj)
{
if (obj == null || waitingForRefresh) { return false; }
if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text))
{
joinButton.Enabled = true;
}
else
{
joinButton.Enabled = false;
}
return true;
}
private bool SelectServer(GUIComponent component, object obj) private bool SelectServer(GUIComponent component, object obj)
{ {
if (obj == null || waitingForRefresh || (!(obj is ServerInfo))) { return false; } if (obj == null || waitingForRefresh || (!(obj is ServerInfo))) { return false; }
@@ -469,16 +485,14 @@ namespace Barotrauma
{ {
string toolTip = ""; string toolTip = "";
if (serverInfo.GameVersion != GameMain.Version.ToString()) if (serverInfo.GameVersion != GameMain.Version.ToString())
toolTip = TextManager.Get("ServerListIncompatibleVersion").Replace("[version]", serverInfo.GameVersion); toolTip = TextManager.GetWithVariable("ServerListIncompatibleVersion", "[version]", serverInfo.GameVersion);
for (int i = 0; i < serverInfo.ContentPackageNames.Count; i++) for (int i = 0; i < serverInfo.ContentPackageNames.Count; i++)
{ {
if (!GameMain.SelectedPackages.Any(cp => cp.MD5hash.Hash == serverInfo.ContentPackageHashes[i])) if (!GameMain.SelectedPackages.Any(cp => cp.MD5hash.Hash == serverInfo.ContentPackageHashes[i]))
{ {
if (toolTip != "") toolTip += "\n"; if (toolTip != "") toolTip += "\n";
toolTip += TextManager.Get("ServerListIncompatibleContentPackage") toolTip += TextManager.GetWithVariables("ServerListIncompatibleContentPackage", new string[2] { "[contentpackage]", "[hash]" }, new string[2] { serverInfo.ContentPackageNames[i], Md5Hash.GetShortHash(serverInfo.ContentPackageHashes[i]) });
.Replace("[contentpackage]", serverInfo.ContentPackageNames[i])
.Replace("[hash]", Md5Hash.GetShortHash(serverInfo.ContentPackageHashes[i]));
} }
} }
@@ -542,7 +556,7 @@ namespace Barotrauma
if (masterServerResponse.ErrorException != null) if (masterServerResponse.ErrorException != null)
{ {
serverList.ClearChildren(); serverList.ClearChildren();
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"), TextManager.Get("MasterServerErrorException").Replace("[error]", masterServerResponse.ErrorException.ToString())); new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"), TextManager.GetWithVariable("MasterServerErrorException", "[error]", masterServerResponse.ErrorException.ToString()));
} }
else if (masterServerResponse.StatusCode != System.Net.HttpStatusCode.OK) else if (masterServerResponse.StatusCode != System.Net.HttpStatusCode.OK)
{ {
@@ -552,24 +566,16 @@ namespace Barotrauma
{ {
case System.Net.HttpStatusCode.NotFound: case System.Net.HttpStatusCode.NotFound:
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"), new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
TextManager.Get("MasterServerError404") TextManager.GetWithVariable("MasterServerError404", "[masterserverurl]", NetConfig.MasterServerUrl));
.Replace("[masterserverurl]", NetConfig.MasterServerUrl)
.Replace("[statuscode]", masterServerResponse.StatusCode.ToString())
.Replace("[statusdescription]", masterServerResponse.StatusDescription));
break; break;
case System.Net.HttpStatusCode.ServiceUnavailable: case System.Net.HttpStatusCode.ServiceUnavailable:
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"), new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
TextManager.Get("MasterServerErrorUnavailable") TextManager.Get("MasterServerErrorUnavailable"));
.Replace("[masterserverurl]", NetConfig.MasterServerUrl)
.Replace("[statuscode]", masterServerResponse.StatusCode.ToString())
.Replace("[statusdescription]", masterServerResponse.StatusDescription));
break; break;
default: default:
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"), new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
TextManager.Get("MasterServerError404") TextManager.GetWithVariables("MasterServerErrorDefault", new string[2] { "[statuscode]", "[statusdescription]" },
.Replace("[masterserverurl]", NetConfig.MasterServerUrl) new string[2] { masterServerResponse.StatusCode.ToString(), masterServerResponse.StatusDescription }));
.Replace("[statuscode]", masterServerResponse.StatusCode.ToString())
.Replace("[statusdescription]", masterServerResponse.StatusDescription));
break; break;
} }
@@ -415,14 +415,14 @@ namespace Barotrauma
{ {
if (SteamManager.UpdateWorkshopItem(item, out string errorMsg)) if (SteamManager.UpdateWorkshopItem(item, out string errorMsg))
{ {
new GUIMessageBox("", TextManager.Get("WorkshopItemUpdated").Replace("[itemname]", TextManager.EnsureUTF8(item.Title))); new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemUpdated", "[itemname]", TextManager.EnsureUTF8(item.Title)));
} }
else else
{ {
DebugConsole.ThrowError(errorMsg); DebugConsole.ThrowError(errorMsg);
new GUIMessageBox( new GUIMessageBox(
TextManager.Get("Error"), TextManager.Get("Error"),
TextManager.Get("WorkshopItemUpdateFailed").Replace("[itemname]", TextManager.EnsureUTF8(item.Title)).Replace("[errormessage]", errorMsg)); TextManager.GetWithVariables("WorkshopItemUpdateFailed", new string[2] { "[itemname]", "[errormessage]" }, new string[2] { TextManager.EnsureUTF8(item.Title), errorMsg }));
} }
btn.Enabled = false; btn.Enabled = false;
btn.Visible = false; btn.Visible = false;
@@ -733,7 +733,7 @@ namespace Barotrauma
new GUIImage(new RectTransform(new Point(scoreContainer.Rect.Height), scoreContainer.RectTransform), new GUIImage(new RectTransform(new Point(scoreContainer.Rect.Height), scoreContainer.RectTransform),
i < starCount ? "GUIStarIconBright" : "GUIStarIconDark"); i < starCount ? "GUIStarIconBright" : "GUIStarIconDark");
} }
new GUITextBlock(new RectTransform(new Vector2(0.2f, 0.0f), scoreContainer.RectTransform), TextManager.Get("WorkshopItemVotes").Replace("[votecount]", (item.VotesUp + item.VotesDown).ToString())); new GUITextBlock(new RectTransform(new Vector2(0.2f, 0.0f), scoreContainer.RectTransform), TextManager.GetWithVariable("WorkshopItemVotes", "[votecount]", (item.VotesUp + item.VotesDown).ToString()));
//tags ------------------------------------ //tags ------------------------------------
var tagContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.05f), content.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft) var tagContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.05f), content.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft)
@@ -857,7 +857,7 @@ namespace Barotrauma
if (!item.Installed) if (!item.Installed)
{ {
new GUIMessageBox(TextManager.Get("Error"), new GUIMessageBox(TextManager.Get("Error"),
TextManager.Get("WorkshopErrorInstallRequiredToEdit").Replace("[itemname]", TextManager.EnsureUTF8(item.Title))); TextManager.GetWithVariable("WorkshopErrorInstallRequiredToEdit", "[itemname]", TextManager.EnsureUTF8(item.Title)));
return; return;
} }
SteamManager.CreateWorkshopItemStaging(item, out itemEditor, out itemContentPackage); SteamManager.CreateWorkshopItemStaging(item, out itemEditor, out itemContentPackage);
@@ -1025,9 +1025,8 @@ namespace Barotrauma
{ {
new GUIMessageBox( new GUIMessageBox(
TextManager.Get("Error"), TextManager.Get("Error"),
TextManager.Get("ContentPackageCantMakeCorePackage") TextManager.GetWithVariables("ContentPackageCantMakeCorePackage", new string[2] { "[packagename]", "[missingfiletypes]" },
.Replace("[packagename]", itemContentPackage.Name) new string[2] { itemContentPackage.Name, string.Join(", ", missingContentTypes) }, new bool[2] { false, true }));
.Replace("[missingfiletypes]", string.Join(", ", missingContentTypes)));
tickbox.Selected = false; tickbox.Selected = false;
} }
else else
@@ -1154,7 +1153,7 @@ namespace Barotrauma
OnClicked = (btn, userData) => OnClicked = (btn, userData) =>
{ {
if (itemEditor == null) { return false; } if (itemEditor == null) { return false; }
var deleteVerification = new GUIMessageBox("", TextManager.Get("WorkshopItemDeleteVerification").Replace("[itemname]", itemEditor.Title), var deleteVerification = new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemDeleteVerification", "[itemname]", itemEditor.Title),
new string[] { TextManager.Get("Yes"), TextManager.Get("No") }); new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
deleteVerification.Buttons[0].OnClicked = (yesBtn, userdata) => deleteVerification.Buttons[0].OnClicked = (yesBtn, userdata) =>
{ {
@@ -1356,7 +1355,7 @@ namespace Barotrauma
string pleaseWaitText = TextManager.Get("WorkshopPublishPleaseWait"); string pleaseWaitText = TextManager.Get("WorkshopPublishPleaseWait");
var msgBox = new GUIMessageBox( var msgBox = new GUIMessageBox(
pleaseWaitText, pleaseWaitText,
TextManager.Get("WorkshopPublishInProgress").Replace("[itemname]", TextManager.EnsureUTF8(item.Title)), TextManager.GetWithVariable("WorkshopPublishInProgress", "[itemname]", TextManager.EnsureUTF8(item.Title)),
new string[] { TextManager.Get("Cancel") }); new string[] { TextManager.Get("Cancel") });
msgBox.Buttons[0].OnClicked = (btn, userdata) => msgBox.Buttons[0].OnClicked = (btn, userdata) =>
@@ -1378,13 +1377,13 @@ namespace Barotrauma
if (string.IsNullOrEmpty(item.Error)) if (string.IsNullOrEmpty(item.Error))
{ {
new GUIMessageBox("", TextManager.Get("WorkshopItemPublished").Replace("[itemname]", TextManager.EnsureUTF8(item.Title))); new GUIMessageBox("", TextManager.GetWithVariable("WorkshopItemPublished", "[itemname]", TextManager.EnsureUTF8(item.Title)));
} }
else else
{ {
new GUIMessageBox( new GUIMessageBox(
TextManager.Get("Error"), TextManager.Get("Error"),
TextManager.Get("WorkshopItemPublishFailed").Replace("[itemname]", TextManager.EnsureUTF8(item.Title)) + item.Error); TextManager.GetWithVariable("WorkshopItemPublishFailed", "[itemname]", TextManager.EnsureUTF8(item.Title)) + item.Error);
} }
createItemFrame.ClearChildren(); createItemFrame.ClearChildren();
@@ -115,7 +115,7 @@ namespace Barotrauma
{ {
if (buoyancyVol / selectedVol < 1.0f) if (buoyancyVol / selectedVol < 1.0f)
{ {
retVal += " (" + TextManager.Get("OptimalBallastLevel").Replace("[value]", (buoyancyVol / selectedVol).ToString("0.000")) + ")"; retVal += " (" + TextManager.GetWithVariable("OptimalBallastLevel", "[value]", (buoyancyVol / selectedVol).ToString("0.000")) + ")";
} }
else else
{ {
@@ -572,7 +572,7 @@ namespace Barotrauma
ItemAssemblyPrefab assemblyPrefab = userData as ItemAssemblyPrefab; ItemAssemblyPrefab assemblyPrefab = userData as ItemAssemblyPrefab;
var msgBox = new GUIMessageBox( var msgBox = new GUIMessageBox(
TextManager.Get("DeleteDialogLabel"), TextManager.Get("DeleteDialogLabel"),
TextManager.Get("DeleteDialogQuestion").Replace("[file]", assemblyPrefab.Name), TextManager.GetWithVariable("DeleteDialogQuestion", "[file]", assemblyPrefab.Name),
new string[] { TextManager.Get("Yes"), TextManager.Get("Cancel") }); new string[] { TextManager.Get("Yes"), TextManager.Get("Cancel") });
msgBox.Buttons[0].OnClicked += (deleteBtn, userData2) => msgBox.Buttons[0].OnClicked += (deleteBtn, userData2) =>
{ {
@@ -584,7 +584,7 @@ namespace Barotrauma
} }
catch (Exception e) catch (Exception e)
{ {
DebugConsole.ThrowError(TextManager.Get("DeleteFileError").Replace("[file]", assemblyPrefab.Name), e); DebugConsole.ThrowError(TextManager.GetWithVariable("DeleteFileError", "[file]", assemblyPrefab.Name), e);
} }
return true; return true;
}; };
@@ -861,7 +861,7 @@ namespace Barotrauma
{ {
if (nameBox.Text.Contains(illegalChar)) if (nameBox.Text.Contains(illegalChar))
{ {
GUI.AddMessage(TextManager.Get("SubNameIllegalCharsWarning").Replace("[illegalchar]", illegalChar.ToString()), Color.Red); GUI.AddMessage(TextManager.GetWithVariable("SubNameIllegalCharsWarning", "[illegalchar]", illegalChar.ToString()), Color.Red);
nameBox.Flash(); nameBox.Flash();
return false; return false;
} }
@@ -907,7 +907,7 @@ namespace Barotrauma
} }
Submarine.MainSub.CheckForErrors(); Submarine.MainSub.CheckForErrors();
GUI.AddMessage(TextManager.Get("SubSavedNotification").Replace("[filepath]", Submarine.MainSub.FilePath), Color.Green); GUI.AddMessage(TextManager.GetWithVariable("SubSavedNotification", "[filepath]", Submarine.MainSub.FilePath), Color.Green);
Submarine.RefreshSavedSub(savePath); Submarine.RefreshSavedSub(savePath);
if (prevSavePath != null && prevSavePath != savePath) if (prevSavePath != null && prevSavePath != savePath)
@@ -1259,7 +1259,7 @@ namespace Barotrauma
{ {
if (nameBox.Text.Contains(illegalChar)) if (nameBox.Text.Contains(illegalChar))
{ {
GUI.AddMessage(TextManager.Get("ItemAssemblyNameIllegalCharsWarning").Replace("[illegalchar]", illegalChar.ToString()), Color.Red); GUI.AddMessage(TextManager.GetWithVariable("ItemAssemblyNameIllegalCharsWarning", "[illegalchar]", illegalChar.ToString()), Color.Red);
nameBox.Flash(); nameBox.Flash();
return false; return false;
} }
@@ -1476,7 +1476,7 @@ namespace Barotrauma
var msgBox = new GUIMessageBox( var msgBox = new GUIMessageBox(
TextManager.Get("DeleteDialogLabel"), TextManager.Get("DeleteDialogLabel"),
TextManager.Get("DeleteDialogQuestion").Replace("[file]", sub.Name), TextManager.GetWithVariable("DeleteDialogQuestion", "[file]", sub.Name),
new string[] { TextManager.Get("Yes"), TextManager.Get("Cancel") }); new string[] { TextManager.Get("Yes"), TextManager.Get("Cancel") });
msgBox.Buttons[0].OnClicked += (btn, userData) => msgBox.Buttons[0].OnClicked += (btn, userData) =>
{ {
@@ -1489,7 +1489,7 @@ namespace Barotrauma
} }
catch (Exception e) catch (Exception e)
{ {
DebugConsole.ThrowError(TextManager.Get("DeleteFileError").Replace("[file]", sub.FilePath), e); DebugConsole.ThrowError(TextManager.GetWithVariable("DeleteFileError", "[file]", sub.FilePath), e);
} }
return true; return true;
}; };
@@ -536,12 +536,12 @@ namespace Barotrauma
if (translatedText == null) if (translatedText == null)
{ {
propertyBox.TextColor = Color.Gray; propertyBox.TextColor = Color.Gray;
propertyBox.ToolTip = TextManager.Get("StringPropertyCannotTranslate").Replace("[tag]", text ?? ""); propertyBox.ToolTip = TextManager.GetWithVariable("StringPropertyCannotTranslate", "[tag]", text ?? string.Empty);
} }
else else
{ {
propertyBox.TextColor = Color.LightGreen; propertyBox.TextColor = Color.LightGreen;
propertyBox.ToolTip = TextManager.Get("StringPropertyTranslate").Replace("[translation]", translatedText); propertyBox.ToolTip = TextManager.GetWithVariable("StringPropertyTranslate", "[translation]", translatedText);
} }
return true; return true;
}; };
@@ -80,8 +80,8 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="GameAnalytics.Mono, Version=1.0.7018.15293, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="GameAnalytics.Mono, Version=1.0.6710.29255, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\GameAnalytics.Mono.dll</HintPath> <HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll</HintPath>
</Reference> </Reference>
<Reference Include="MonoGame.Framework, Version=3.7.1.189, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="MonoGame.Framework, Version=3.7.1.189, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.7.1.189\lib\net45\MonoGame.Framework.dll</HintPath> <HintPath>..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.7.1.189\lib\net45\MonoGame.Framework.dll</HintPath>
@@ -132,7 +132,7 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" /> <Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Data.SQLite, Version=1.0.102.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> <Reference Include="System.Data.SQLite, Version=1.0.102.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\System.Data.SQLite.dll</HintPath> <HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\System.Data.SQLite.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" /> <Reference Include="System.IO.Compression" />
@@ -307,12 +307,12 @@
<Import Project="..\BarotraumaShared\SharedCode.projitems" Label="Shared" /> <Import Project="..\BarotraumaShared\SharedCode.projitems" Label="Shared" />
<Import Project="..\BarotraumaShared\SharedContent.projitems" Label="Shared" /> <Import Project="..\BarotraumaShared\SharedContent.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets" Condition="Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets')" /> <Import Project="..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets" Condition="Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets'))" /> <Error Condition="!Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets'))" />
<Error Condition="!Exists('..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.7.1.189\build\MonoGame.Framework.WindowsDX.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.7.1.189\build\MonoGame.Framework.WindowsDX.targets'))" /> <Error Condition="!Exists('..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.7.1.189\build\MonoGame.Framework.WindowsDX.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.7.1.189\build\MonoGame.Framework.WindowsDX.targets'))" />
</Target> </Target>
<Import Project="..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.7.1.189\build\MonoGame.Framework.WindowsDX.targets" Condition="Exists('..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.7.1.189\build\MonoGame.Framework.WindowsDX.targets')" /> <Import Project="..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.7.1.189\build\MonoGame.Framework.WindowsDX.targets" Condition="Exists('..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.7.1.189\build\MonoGame.Framework.WindowsDX.targets')" />
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="GameAnalytics.Mono.SDK" version="2.1.6" targetFramework="net45" /> <package id="GameAnalytics.Mono.SDK" version="1.1.12" targetFramework="net45" />
<package id="Microsoft.NETCore.Platforms" version="3.0.0-preview.19073.11" targetFramework="net45" /> <package id="Microsoft.NETCore.Platforms" version="3.0.0-preview.19073.11" targetFramework="net45" />
<package id="MonoGame.Framework.DesktopGL" version="3.7.1.189" targetFramework="net45" /> <package id="MonoGame.Framework.DesktopGL" version="3.7.1.189" targetFramework="net45" />
<package id="MonoGame.Framework.WindowsDX" version="3.7.1.189" targetFramework="net45" /> <package id="MonoGame.Framework.WindowsDX" version="3.7.1.189" targetFramework="net45" />
+7 -13
View File
@@ -149,13 +149,7 @@
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="GameAnalytics.Mono, Version=1.0.7018.15293, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\GameAnalytics.Mono.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data.SQLite, Version=1.0.102.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\lib\net45\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
@@ -169,6 +163,12 @@
<Reference Include="NLog"> <Reference Include="NLog">
<HintPath>..\..\Libraries\NuGet\NLog.4.3.8\lib\net45\NLog.dll</HintPath> <HintPath>..\..\Libraries\NuGet\NLog.4.3.8\lib\net45\NLog.dll</HintPath>
</Reference> </Reference>
<Reference Include="GameAnalytics.Mono">
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite">
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="RestSharp"> <Reference Include="RestSharp">
<HintPath>..\..\Libraries\NuGet\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath> <HintPath>..\..\Libraries\NuGet\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
</Reference> </Reference>
@@ -293,11 +293,5 @@
<Import Project="..\BarotraumaShared\SharedCode.projitems" Label="Shared" /> <Import Project="..\BarotraumaShared\SharedCode.projitems" Label="Shared" />
<Import Project="..\BarotraumaShared\SharedContent.projitems" Label="Shared" /> <Import Project="..\BarotraumaShared\SharedContent.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets" Condition="Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets')" /> <Import Project="..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets" Condition="Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.2.1.6\build\net45\GameAnalytics.Mono.SDK.targets'))" />
</Target>
</Project> </Project>
@@ -128,9 +128,7 @@ namespace Barotrauma
var exePaths = contentPackage.GetFilesOfType(ContentType.ServerExecutable); var exePaths = contentPackage.GetFilesOfType(ContentType.ServerExecutable);
if (exePaths.Count() > 0 && AppDomain.CurrentDomain.FriendlyName != exePaths.First()) if (exePaths.Count() > 0 && AppDomain.CurrentDomain.FriendlyName != exePaths.First())
{ {
DebugConsole.ShowQuestionPrompt(TextManager.Get("IncorrectExe") DebugConsole.ShowQuestionPrompt(TextManager.GetWithVariables("IncorrectExe", new string[2] { "[selectedpackage]", "[exename]" }, new string[2] { contentPackage.Name, exePaths.First() }),
.Replace("[selectedpackage]", contentPackage.Name)
.Replace("[exename]", exePaths.First()),
(option) => (option) =>
{ {
if (option.ToLower() == "y" || option.ToLower() == "yes") if (option.ToLower() == "y" || option.ToLower() == "yes")
@@ -298,7 +296,7 @@ namespace Barotrauma
CloseServer(); CloseServer();
SteamManager.ShutDown(); SteamManager.ShutDown();
if (GameSettings.SendUserStatistics) GameAnalytics.OnQuit(); if (GameSettings.SendUserStatistics) GameAnalytics.OnStop();
} }
public static void ResetFrameTime() public static void ResetFrameTime()
@@ -16,10 +16,9 @@ namespace Barotrauma
public void Greet(GameServer server, string codeWords, string codeResponse) public void Greet(GameServer server, string codeWords, string codeResponse)
{ {
string greetingMessage = TextManager.Get("TraitorStartMessage").Replace("[targetname]", TargetCharacter.Name); string greetingMessage = TextManager.GetWithVariable("TraitorStartMessage", "[targetname]", TargetCharacter.Name);
string moreAgentsMessage = TextManager.Get("TraitorMoreAgentsMessage") string moreAgentsMessage = TextManager.GetWithVariables("TraitorMoreAgentsMessage",
.Replace("[codewords]", codeWords) new string[2] { "[codewords]", "[coderesponse]" }, new string[2] { codeWords, codeResponse });
.Replace("[coderesponse]", codeResponse);
var greetingChatMsg = ChatMessage.Create(null, greetingMessage, ChatMessageType.Server, null); var greetingChatMsg = ChatMessage.Create(null, greetingMessage, ChatMessageType.Server, null);
var moreAgentsChatMsg = ChatMessage.Create(null, moreAgentsMessage, ChatMessageType.Server, null); var moreAgentsChatMsg = ChatMessage.Create(null, moreAgentsMessage, ChatMessageType.Server, null);
@@ -38,7 +37,7 @@ namespace Barotrauma
{ {
var ownerMsg = ChatMessage.Create( var ownerMsg = ChatMessage.Create(
null,//TextManager.Get("NewTraitor"), null,//TextManager.Get("NewTraitor"),
TextManager.Get("TraitorStartMessageServer").Replace("[targetname]", TargetCharacter.Name).Replace("[traitorname]", Character.Name), TextManager.GetWithVariables("TraitorStartMessageServer", new string[2] { "[targetname]", "[traitorname]" }, new string[2] { TargetCharacter.Name, Character.Name }),
ChatMessageType.MessageBox, ChatMessageType.MessageBox,
null null
); );
@@ -193,7 +193,7 @@ namespace Barotrauma
{ {
if (GameMain.Server == null) return; if (GameMain.Server == null) return;
msg.Write(Prefab.OriginalName); msg.Write(Prefab.Name);
msg.Write(Prefab.Identifier); msg.Write(Prefab.Identifier);
msg.Write(Description != prefab.Description); msg.Write(Description != prefab.Description);
if (Description != prefab.Description) if (Description != prefab.Description)
@@ -415,7 +415,7 @@ namespace Barotrauma.Networking
{ {
if (endRoundTimer <= 0.0f) if (endRoundTimer <= 0.0f)
{ {
SendChatMessage(TextManager.Get("CrewDeadNoRespawns").Replace("[time]", "60"), ChatMessageType.Server); SendChatMessage(TextManager.GetWithVariable("CrewDeadNoRespawns", "[time]", "60"), ChatMessageType.Server);
} }
endRoundTimer += deltaTime; endRoundTimer += deltaTime;
} }
@@ -728,7 +728,7 @@ namespace Barotrauma.Networking
if (matchingSub == null) if (matchingSub == null)
{ {
SendDirectChatMessage( SendDirectChatMessage(
TextManager.Get("CampaignStartFailedSubNotFound").Replace("[subname]", subName), TextManager.GetWithVariable("CampaignStartFailedSubNotFound", "[subname]", subName),
connectedClient, ChatMessageType.MessageBox); connectedClient, ChatMessageType.MessageBox);
} }
else else
@@ -232,7 +232,7 @@ namespace Barotrauma.Networking
//add the ID card tags they should've gotten when spawning in the shuttle //add the ID card tags they should've gotten when spawning in the shuttle
foreach (Item item in character.Inventory.Items) foreach (Item item in character.Inventory.Items)
{ {
if (item == null || item.Prefab.Identifier != "idcard") continue; if (item == null || item.Prefab.Name != "ID Card") continue;
foreach (string s in shuttleSpawnPoints[i].IdCardTags) foreach (string s in shuttleSpawnPoints[i].IdCardTags)
{ {
item.AddTag(s); item.AddTag(s);
@@ -37,7 +37,7 @@ namespace Barotrauma.Steam
public static bool RefreshServerDetails(Networking.GameServer server) public static bool RefreshServerDetails(Networking.GameServer server)
{ {
if (instance?.server == null || !instance.isInitialized) if (instance == null || !instance.isInitialized)
{ {
return false; return false;
} }
@@ -35,7 +35,7 @@ namespace Barotrauma
inputThread.Start(); inputThread.Start();
game.Run(); game.Run();
inputThread.Abort(); inputThread.Join(); inputThread.Abort(); inputThread.Join();
if (GameSettings.SendUserStatistics) GameAnalytics.OnQuit(); if (GameSettings.SendUserStatistics) GameAnalytics.OnStop();
SteamManager.ShutDown(); SteamManager.ShutDown();
#if !DEBUG #if !DEBUG
} }
@@ -382,7 +382,7 @@ namespace Barotrauma
if (Character.PressureTimer > 50.0f && Character.CurrentHull != null) if (Character.PressureTimer > 50.0f && Character.CurrentHull != null)
{ {
Character.Speak(TextManager.Get("DialogPressure").Replace("[roomname]", Character.CurrentHull.DisplayName), null, 0, "pressure", 30.0f); Character.Speak(TextManager.GetWithVariable("DialogPressure", "[roomname]", Character.CurrentHull.DisplayName, true), null, 0, "pressure", 30.0f);
} }
} }
@@ -111,7 +111,7 @@ namespace Barotrauma
extinguisher.Use(deltaTime, character); extinguisher.Use(deltaTime, character);
if (!targetHull.FireSources.Contains(fs)) if (!targetHull.FireSources.Contains(fs))
{ {
character.Speak(TextManager.Get("DialogPutOutFire").Replace("[roomname]", targetHull.Name), null, 0, "putoutfire", 10.0f); character.Speak(TextManager.GetWithVariable("DialogPutOutFire", "[roomname]", targetHull.Name, true), null, 0, "putoutfire", 10.0f);
} }
} }
} }
@@ -234,7 +234,6 @@ namespace Barotrauma
switch (order.AITag.ToLowerInvariant()) switch (order.AITag.ToLowerInvariant())
{ {
case "follow": case "follow":
if (orderGiver == null) { return null; }
newObjective = new AIObjectiveGoTo(orderGiver, character, this, repeat: true, priorityModifier: priorityModifier) newObjective = new AIObjectiveGoTo(orderGiver, character, this, repeat: true, priorityModifier: priorityModifier)
{ {
CloseEnough = 150, CloseEnough = 150,
@@ -60,7 +60,7 @@ namespace Barotrauma
ItemComponent target = useController ? controller : component; ItemComponent target = useController ? controller : component;
if (useController && controller == null) if (useController && controller == null)
{ {
character.Speak(TextManager.Get("DialogCantFindController").Replace("[item]", component.Item.Name), null, 2.0f, "cantfindcontroller", 30.0f); character.Speak(TextManager.GetWithVariable("DialogCantFindController", "[item]", component.Item.Name, true), null, 2.0f, "cantfindcontroller", 30.0f);
abandon = true; abandon = true;
return; return;
} }
@@ -45,7 +45,7 @@ namespace Barotrauma
bool isCompleted = Item.IsFullCondition; bool isCompleted = Item.IsFullCondition;
if (isCompleted) if (isCompleted)
{ {
character?.Speak(TextManager.Get("DialogItemRepaired").Replace("[itemname]", Item.Name), null, 0.0f, "itemrepaired", 10.0f); character?.Speak(TextManager.GetWithVariable("DialogItemRepaired", "[itemname]", Item.Name, true), null, 0.0f, "itemrepaired", 10.0f);
} }
return isCompleted; return isCompleted;
} }
@@ -140,7 +140,7 @@ namespace Barotrauma
{ {
// If the current condition is less than the previous condition, we can't complete the task, so let's abandon it. The item is probably deteriorating at a greater speed than we can repair it. // If the current condition is less than the previous condition, we can't complete the task, so let's abandon it. The item is probably deteriorating at a greater speed than we can repair it.
abandon = true; abandon = true;
character?.Speak(TextManager.Get("DialogCannotRepair").Replace("[itemname]", Item.Name), null, 0.0f, "cannotrepair", 10.0f); character?.Speak(TextManager.GetWithVariable("DialogCannotRepair", "[itemname]", Item.Name, true), null, 0.0f, "cannotrepair", 10.0f);
} }
} }
repairable.CurrentFixer = abandon && repairable.CurrentFixer == character ? null : character; repairable.CurrentFixer = abandon && repairable.CurrentFixer == character ? null : character;
@@ -162,7 +162,7 @@ namespace Barotrauma
} }
return objective; return objective;
}, },
onAbandon: () => character.Speak(TextManager.Get("DialogCannotRepair").Replace("[itemname]", Item.Name), null, 0.0f, "cannotrepair", 10.0f)); onAbandon: () => character.Speak(TextManager.GetWithVariable("DialogCannotRepair", "[itemname]", Item.Name, true), null, 0.0f, "cannotrepair", 10.0f));
} }
} }
@@ -58,10 +58,9 @@ namespace Barotrauma
{ {
if (character.SelectedCharacter != targetCharacter) if (character.SelectedCharacter != targetCharacter)
{ {
character.Speak(TextManager.Get("DialogFoundUnconsciousTarget") character.Speak(TextManager.GetWithVariables("DialogFoundUnconsciousTarget", new string[2] { "[targetname]", "[roomname]" },
.Replace("[targetname]", targetCharacter.Name).Replace("[roomname]", targetCharacter.CurrentHull.DisplayName), new string[2] { targetCharacter.Name, targetCharacter.CurrentHull.DisplayName }, new bool[2] { false, true }),
null, 1.0f, null, 1.0f, "foundunconscioustarget" + targetCharacter.Name, 60.0f);
"foundunconscioustarget" + targetCharacter.Name, 60.0f);
// Go to the target and select it // Go to the target and select it
if (!character.CanInteractWith(targetCharacter)) if (!character.CanInteractWith(targetCharacter))
@@ -114,10 +113,9 @@ namespace Barotrauma
// We can start applying treatment // We can start applying treatment
if (character.SelectedCharacter != targetCharacter) if (character.SelectedCharacter != targetCharacter)
{ {
character.Speak(TextManager.Get("DialogFoundWoundedTarget") character.Speak(TextManager.GetWithVariables("DialogFoundWoundedTarget", new string[2] { "[targetname]", "[roomname]" },
.Replace("[targetname]", targetCharacter.Name).Replace("[roomname]", targetCharacter.CurrentHull.DisplayName), new string[2] { targetCharacter.Name, targetCharacter.CurrentHull.DisplayName }, new bool[2] { false, true }),
null, 1.0f, null, 1.0f, "foundwoundedtarget" + targetCharacter.Name, 60.0f);
"foundwoundedtarget" + targetCharacter.Name, 60.0f);
character.SelectCharacter(targetCharacter); character.SelectCharacter(targetCharacter);
} }
@@ -191,9 +189,10 @@ namespace Barotrauma
{ {
itemListStr = string.Join(" or ", string.Join(", ", itemNameList.Take(itemNameList.Count - 1)), itemNameList.Last()); itemListStr = string.Join(" or ", string.Join(", ", itemNameList.Take(itemNameList.Count - 1)), itemNameList.Last());
} }
character.Speak(TextManager.Get("DialogListRequiredTreatments")
.Replace("[targetname]", targetCharacter.Name)
.Replace("[treatmentlist]", itemListStr), character.Speak(TextManager.GetWithVariables("DialogListRequiredTreatments", new string[2] { "[targetname]", "[treatmentlist]" },
new string[2] { targetCharacter.Name, itemListStr }, new bool[2] { false, true }),
null, 2.0f, "listrequiredtreatments" + targetCharacter.Name, 60.0f); null, 2.0f, "listrequiredtreatments" + targetCharacter.Name, 60.0f);
} }
character.DeselectCharacter(); character.DeselectCharacter();
@@ -236,7 +235,7 @@ namespace Barotrauma
bool isCompleted = targetCharacter.Bleeding <= 0 && targetCharacter.Vitality / targetCharacter.MaxVitality > AIObjectiveRescueAll.GetVitalityThreshold(objectiveManager); bool isCompleted = targetCharacter.Bleeding <= 0 && targetCharacter.Vitality / targetCharacter.MaxVitality > AIObjectiveRescueAll.GetVitalityThreshold(objectiveManager);
if (isCompleted) if (isCompleted)
{ {
character.Speak(TextManager.Get("DialogTargetHealed").Replace("[targetname]", targetCharacter.Name), character.Speak(TextManager.GetWithVariable("DialogTargetHealed", "[targetname]", targetCharacter.Name),
null, 1.0f, "targethealed" + targetCharacter.Name, 60.0f); null, 1.0f, "targethealed" + targetCharacter.Name, 60.0f);
} }
return isCompleted || targetCharacter.IsDead; return isCompleted || targetCharacter.IsDead;
@@ -171,12 +171,12 @@ namespace Barotrauma
string messageTag = (givingOrderToSelf && !TargetAllCharacters ? "OrderDialogSelf." : "OrderDialog.") + AITag; string messageTag = (givingOrderToSelf && !TargetAllCharacters ? "OrderDialogSelf." : "OrderDialog.") + AITag;
if (!string.IsNullOrEmpty(orderOption)) messageTag += "." + orderOption; if (!string.IsNullOrEmpty(orderOption)) messageTag += "." + orderOption;
string msg = TextManager.Get(messageTag, true);
if (msg == null) return "";
if (targetCharacterName == null) targetCharacterName = ""; if (targetCharacterName == null) targetCharacterName = "";
if (targetRoomName == null) targetRoomName = ""; if (targetRoomName == null) targetRoomName = "";
return msg.Replace("[name]", targetCharacterName).Replace("[roomname]", targetRoomName); string msg = TextManager.GetWithVariables(messageTag, new string[2] { "[name]", "[roomname]" }, new string[2] { targetCharacterName, targetRoomName }, true);
if (msg == null) return "";
return msg;
} }
} }
@@ -17,12 +17,6 @@ namespace Barotrauma
{ {
public abstract RagdollParams RagdollParams { get; protected set; } public abstract RagdollParams RagdollParams { get; protected set; }
const float ImpactDamageMultiplayer = 10.0f;
/// <summary>
/// Maximum damage per impact (0.1 = 10% of the character's maximum health)
/// </summary>
const float MaxImpactDamage = 0.1f;
private static List<Ragdoll> list = new List<Ragdoll>(); private static List<Ragdoll> list = new List<Ragdoll>();
protected Hull currentHull; protected Hull currentHull;
@@ -694,10 +688,8 @@ namespace Barotrauma
Vector2 impactPos = ConvertUnits.ToDisplayUnits(points[0]); Vector2 impactPos = ConvertUnits.ToDisplayUnits(points[0]);
if (character.Submarine != null) impactPos += character.Submarine.Position; if (character.Submarine != null) impactPos += character.Submarine.Position;
float impactDamage = Math.Min((impact - ImpactTolerance) * ImpactDamageMultiplayer, character.MaxVitality * MaxImpactDamage);
character.LastDamageSource = null; character.LastDamageSource = null;
character.AddDamage(impactPos, new List<Affliction>() { AfflictionPrefab.InternalDamage.Instantiate(impactDamage) }, 0.0f, true); character.AddDamage(impactPos, new List<Affliction>() { AfflictionPrefab.InternalDamage.Instantiate((impact - ImpactTolerance) * 10.0f) }, 0.0f, true);
strongestImpact = Math.Max(strongestImpact, impact - ImpactTolerance); strongestImpact = Math.Max(strongestImpact, impact - ImpactTolerance);
character.ApplyStatusEffects(ActionType.OnImpact, 1.0f); character.ApplyStatusEffects(ActionType.OnImpact, 1.0f);
//briefly disable impact damage //briefly disable impact damage
@@ -1311,6 +1303,13 @@ namespace Barotrauma
} }
} }
} }
foreach (Limb limb in Limbs)
{
limb.body.SetTransform(Collider.SimPosition, 0.0f);
limb.body.ResetDynamics();
}
SetInitialLimbPositions();
return false;
} }
UpdateProjSpecific(deltaTime); UpdateProjSpecific(deltaTime);
} }
@@ -217,16 +217,7 @@ namespace Barotrauma
limb.body.AngularVelocity = matchingLimb.body.AngularVelocity; limb.body.AngularVelocity = matchingLimb.body.AngularVelocity;
} }
} }
for (int i = 0; i < character.Inventory.Items.Length; i++)
if (character.Inventory.Items.Length != husk.Inventory.Items.Length)
{
string errorMsg = "Failed to move items from a human's inventory into a humanhusk's inventory (inventory sizes don't match)";
DebugConsole.ThrowError(errorMsg);
GameAnalyticsManager.AddErrorEventOnce("AfflictionHusk.CreateAIHusk:InventoryMismatch", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
yield return CoroutineStatus.Success;
}
for (int i = 0; i < character.Inventory.Items.Length && i < husk.Inventory.Items.Length; i++)
{ {
if (character.Inventory.Items[i] == null) continue; if (character.Inventory.Items[i] == null) continue;
husk.Inventory.TryPutItem(character.Inventory.Items[i], i, true, false, null); husk.Inventory.TryPutItem(character.Inventory.Items[i], i, true, false, null);
@@ -108,7 +108,7 @@ namespace Barotrauma
} }
#if CLIENT #if CLIENT
new GUIMessageBox("", TextManager.Get("CargoSpawnNotification").Replace("[roomname]", cargoRoom.DisplayName)); new GUIMessageBox("", TextManager.GetWithVariable("CargoSpawnNotification", "[roomname]", cargoRoom.DisplayName, true));
#endif #endif
Dictionary<ItemContainer, int> availableContainers = new Dictionary<ItemContainer, int>(); Dictionary<ItemContainer, int> availableContainers = new Dictionary<ItemContainer, int>();
@@ -193,7 +193,7 @@ namespace Barotrauma
character.TeamID = Character.TeamType.FriendlyNPC; character.TeamID = Character.TeamType.FriendlyNPC;
character.SetCustomInteract( character.SetCustomInteract(
WatchmanInteract, WatchmanInteract,
hudText: TextManager.Get("TalkHint").Replace("[key]", GameMain.Config.KeyBind(InputType.Select).ToString())); hudText: TextManager.GetWithVariable("TalkHint", "[key]", GameMain.Config.KeyBind(InputType.Select).ToString()));
} }
protected abstract void WatchmanInteract(Character watchman, Character interactor); protected abstract void WatchmanInteract(Character watchman, Character interactor);
@@ -159,14 +159,8 @@ namespace Barotrauma
public void StartRound(Level level, bool reloadSub = true, bool loadSecondSub = false, bool mirrorLevel = false) public void StartRound(Level level, bool reloadSub = true, bool loadSecondSub = false, bool mirrorLevel = false)
{ {
#if CLIENT #if CLIENT
if (GameMain.Client == null) GameMain.LightManager.LosEnabled = GameMain.Client == null || GameMain.Client.CharacterInfo != null;
{ if (GameMain.Client == null) GameMain.LightManager.LosMode = GameMain.Config.LosMode;
GameMain.LightManager.LosMode = GameMain.Config.LosMode;
}
else
{
GameMain.LightManager.LosEnabled = GameMain.Client.CharacterInfo != null;
}
#endif #endif
this.Level = level; this.Level = level;
@@ -569,14 +569,12 @@ namespace Barotrauma
//to make sure the package that contains text files has been loaded before we attempt to use TextManager //to make sure the package that contains text files has been loaded before we attempt to use TextManager
foreach (string missingPackagePath in missingPackagePaths) foreach (string missingPackagePath in missingPackagePaths)
{ {
DebugConsole.ThrowError(TextManager.Get("ContentPackageNotFound").Replace("[packagepath]", missingPackagePath)); DebugConsole.ThrowError(TextManager.GetWithVariable("ContentPackageNotFound", "[packagepath]", missingPackagePath));
} }
foreach (ContentPackage incompatiblePackage in incompatiblePackages) foreach (ContentPackage incompatiblePackage in incompatiblePackages)
{ {
DebugConsole.ThrowError(TextManager.Get(incompatiblePackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage") DebugConsole.ThrowError(TextManager.GetWithVariables(incompatiblePackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage",
.Replace("[packagename]", incompatiblePackage.Name) new string[3] { "[packagename]", "[packageversion]", "[gameversion]" }, new string[3] { incompatiblePackage.Name, incompatiblePackage.GameVersion.ToString(), GameMain.Version.ToString() }));
.Replace("[packageversion]", incompatiblePackage.GameVersion.ToString())
.Replace("[gameversion]", GameMain.Version.ToString()));
} }
foreach (ContentPackage contentPackage in SelectedContentPackages) foreach (ContentPackage contentPackage in SelectedContentPackages)
{ {
@@ -955,14 +953,12 @@ namespace Barotrauma
//to make sure the package that contains text files has been loaded before we attempt to use TextManager //to make sure the package that contains text files has been loaded before we attempt to use TextManager
foreach (string missingPackagePath in missingPackagePaths) foreach (string missingPackagePath in missingPackagePaths)
{ {
DebugConsole.ThrowError(TextManager.Get("ContentPackageNotFound").Replace("[packagepath]", missingPackagePath)); DebugConsole.ThrowError(TextManager.GetWithVariable("ContentPackageNotFound", "[packagepath]", missingPackagePath));
} }
foreach (ContentPackage incompatiblePackage in incompatiblePackages) foreach (ContentPackage incompatiblePackage in incompatiblePackages)
{ {
DebugConsole.ThrowError(TextManager.Get(incompatiblePackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage") DebugConsole.ThrowError(TextManager.GetWithVariables(incompatiblePackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage",
.Replace("[packagename]", incompatiblePackage.Name) new string[3] { "[packagename]", "[packageversion]", "[gameversion]" }, new string[3] { incompatiblePackage.Name, incompatiblePackage.GameVersion.ToString(), GameMain.Version.ToString() }));
.Replace("[packageversion]", incompatiblePackage.GameVersion.ToString())
.Replace("[gameversion]", GameMain.Version.ToString()));
} }
} }
@@ -396,11 +396,12 @@ namespace Barotrauma.Items.Components
sinTime = 0; sinTime = 0;
if (!leak.FlowTargetHull.ConnectedGaps.Any(g => !g.IsRoomToRoom && g.Open > 0.0f)) if (!leak.FlowTargetHull.ConnectedGaps.Any(g => !g.IsRoomToRoom && g.Open > 0.0f))
{ {
character.Speak(TextManager.Get("DialogLeaksFixed").Replace("[roomname]", leak.FlowTargetHull.DisplayName), null, 0.0f, "leaksfixed", 10.0f);
character.Speak(TextManager.GetWithVariable("DialogLeaksFixed", "[roomname]", leak.FlowTargetHull.DisplayName, true), null, 0.0f, "leaksfixed", 10.0f);
} }
else else
{ {
character.Speak(TextManager.Get("DialogLeakFixed").Replace("[roomname]", leak.FlowTargetHull.DisplayName), null, 0.0f, "leakfixed", 10.0f); character.Speak(TextManager.GetWithVariable("DialogLeakFixed", "[roomname]", leak.FlowTargetHull.DisplayName, true), null, 0.0f, "leakfixed", 10.0f);
} }
} }
@@ -219,8 +219,10 @@ namespace Barotrauma.Items.Components
{ {
dialogTag = "DialogSonarTargetLarge"; dialogTag = "DialogSonarTargetLarge";
} }
character.Speak(TextManager.Get(dialogTag).Replace("[direction]", targetGroup.Key).Replace("[count]", targetGroup.Value.Count.ToString()),
null, 0, "sonartarget" + targetGroup.Value[0].ID, 30); character.Speak(TextManager.GetWithVariables(dialogTag, new string[2] { "[direction]", "[count]" },
new string[2] { targetGroup.Key.ToString(), targetGroup.Value.Count.ToString() },
new bool[2] { true, false }), null, 0, "sonartarget" + targetGroup.Value[0].ID, 30);
//prevent the character from reporting other targets in the group //prevent the character from reporting other targets in the group
for (int i = 1; i < targetGroup.Value.Count; i++) for (int i = 1; i < targetGroup.Value.Count; i++)
@@ -239,7 +241,7 @@ namespace Barotrauma.Items.Components
int clockDir = (int)Math.Round((angle / MathHelper.TwoPi) * 12); int clockDir = (int)Math.Round((angle / MathHelper.TwoPi) * 12);
if (clockDir == 0) clockDir = 12; if (clockDir == 0) clockDir = 12;
return TextManager.Get("roomname.subdiroclock").Replace("[dir]", clockDir.ToString()); return TextManager.GetWithVariable("roomname.subdiroclock", "[dir]", clockDir.ToString());
} }
private Vector2 GetTransducerPos() private Vector2 GetTransducerPos()
@@ -244,9 +244,10 @@ namespace Barotrauma.Items.Components
#if CLIENT #if CLIENT
rechargeSpeedSlider.BarScroll = RechargeSpeed / Math.Max(maxRechargeSpeed, 1.0f); rechargeSpeedSlider.BarScroll = RechargeSpeed / Math.Max(maxRechargeSpeed, 1.0f);
#endif #endif
character.Speak(TextManager.Get("DialogChargeBatteries")
.Replace("[itemname]", item.Name) character.Speak(TextManager.GetWithVariables("DialogChargeBatteries", new string[2] { "[itemname]", "[rate]" },
.Replace("[rate]", ((int)(rechargeSpeed / maxRechargeSpeed * 100.0f)).ToString()), null, 1.0f, "chargebattery", 10.0f); new string[2] { item.Name, ((int)(rechargeSpeed / maxRechargeSpeed * 100.0f)).ToString() },
new bool[2] { true, false }), null, 1.0f, "chargebattery", 10.0f);
} }
} }
else else
@@ -260,9 +261,9 @@ namespace Barotrauma.Items.Components
#if CLIENT #if CLIENT
rechargeSpeedSlider.BarScroll = RechargeSpeed / Math.Max(maxRechargeSpeed, 1.0f); rechargeSpeedSlider.BarScroll = RechargeSpeed / Math.Max(maxRechargeSpeed, 1.0f);
#endif #endif
character.Speak(TextManager.Get("DialogStopChargingBatteries") character.Speak(TextManager.GetWithVariables("DialogStopChargingBatteries", new string[2] { "[itemname]", "[rate]" },
.Replace("[itemname]", item.Name) new string[2] { item.Name, ((int)(rechargeSpeed / maxRechargeSpeed * 100.0f)).ToString() },
.Replace("[rate]", ((int)(rechargeSpeed / maxRechargeSpeed * 100.0f)).ToString()), null, 1.0f, "chargebattery", 10.0f); new bool[2] { true, false }), null, 1.0f, "chargebattery", 10.0f);
} }
} }
@@ -459,7 +459,7 @@ namespace Barotrauma.Items.Components
} }
var containShellObjective = new AIObjectiveContainItem(character, container.ContainableItems[0].Identifiers[0], container, objective.objectiveManager); var containShellObjective = new AIObjectiveContainItem(character, container.ContainableItems[0].Identifiers[0], container, objective.objectiveManager);
character?.Speak(TextManager.Get("DialogLoadTurret").Replace("[itemname]", item.Name), null, 0.0f, "loadturret", 30.0f); character?.Speak(TextManager.GetWithVariable("DialogLoadTurret", "[itemname]", item.Name, true), null, 0.0f, "loadturret", 30.0f);
containShellObjective.targetItemCount = usableProjectileCount + 1; containShellObjective.targetItemCount = usableProjectileCount + 1;
containShellObjective.ignoredContainerIdentifiers = new string[] { containerItem.prefab.Identifier }; containShellObjective.ignoredContainerIdentifiers = new string[] { containerItem.prefab.Identifier };
objective.AddSubObjective(containShellObjective); objective.AddSubObjective(containShellObjective);
@@ -506,7 +506,7 @@ namespace Barotrauma.Items.Components
if (objective.Option.ToLowerInvariant() == "fireatwill") if (objective.Option.ToLowerInvariant() == "fireatwill")
{ {
character?.Speak(TextManager.Get("DialogFireTurret").Replace("[itemname]", item.Name), null, 0.0f, "fireturret", 5.0f); character?.Speak(TextManager.GetWithVariable("DialogFireTurret", "[itemname]", item.Name, true), null, 0.0f, "fireturret", 5.0f);
character.SetInput(InputType.Shoot, true, true); character.SetInput(InputType.Shoot, true, true);
} }
@@ -1539,9 +1539,8 @@ namespace Barotrauma
{ {
if (requiredSkill != null) if (requiredSkill != null)
{ {
GUI.AddMessage(TextManager.Get("InsufficientSkills") GUI.AddMessage(TextManager.GetWithVariables("InsufficientSkills", new string[2] { "[requiredskill]", "[requiredlevel]" },
.Replace("[requiredskill]", TextManager.Get("SkillName." + requiredSkill.Identifier)) new string[2] { TextManager.Get("SkillName." + requiredSkill.Identifier), ((int)requiredSkill.Level).ToString() }, new bool[2] { true, false }), Color.Red);
.Replace("[requiredlevel]", ((int)requiredSkill.Level).ToString()), Color.Red);
} }
} }
#endif #endif
@@ -656,7 +656,7 @@ namespace Barotrauma.Networking
private set; private set;
} = new List<Pair<int, int>>(); } = new List<Pair<int, int>>();
private void InitMonstersEnabled() public void ReadMonsterEnabled(NetBuffer inc)
{ {
//monster spawn settings //monster spawn settings
if (MonsterEnabled == null) if (MonsterEnabled == null)
@@ -673,11 +673,7 @@ namespace Barotrauma.Networking
if (!MonsterEnabled.ContainsKey(s)) MonsterEnabled.Add(s, true); if (!MonsterEnabled.ContainsKey(s)) MonsterEnabled.Add(s, true);
} }
} }
}
public void ReadMonsterEnabled(NetBuffer inc)
{
InitMonstersEnabled();
List<string> monsterNames = MonsterEnabled.Keys.ToList(); List<string> monsterNames = MonsterEnabled.Keys.ToList();
foreach (string s in monsterNames) foreach (string s in monsterNames)
{ {
@@ -707,17 +703,13 @@ namespace Barotrauma.Networking
Dictionary<ItemPrefab, int> extraCargo = new Dictionary<ItemPrefab, int>(); Dictionary<ItemPrefab, int> extraCargo = new Dictionary<ItemPrefab, int>();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
string prefabIdentifier = msg.ReadString();
string prefabName = msg.ReadString(); string prefabName = msg.ReadString();
byte amount = msg.ReadByte(); byte amount = msg.ReadByte();
ItemPrefab ip = MapEntityPrefab.List.Find(p => p is ItemPrefab && p.Name.Equals(prefabName, StringComparison.InvariantCulture)) as ItemPrefab;
var itemPrefab = string.IsNullOrEmpty(prefabIdentifier) ? if (ip != null && amount > 0)
MapEntityPrefab.Find(prefabName, null, showErrorMessages: false) as ItemPrefab :
MapEntityPrefab.Find(prefabName, prefabIdentifier, showErrorMessages: false) as ItemPrefab;
if (itemPrefab != null && amount > 0)
{ {
if (changed || !ExtraCargo.ContainsKey(itemPrefab) || ExtraCargo[itemPrefab] != amount) changed = true; if (changed || !ExtraCargo.ContainsKey(ip) || ExtraCargo[ip] != amount) changed = true;
extraCargo.Add(itemPrefab, amount); extraCargo.Add(ip, amount);
} }
} }
if (changed) ExtraCargo = extraCargo; if (changed) ExtraCargo = extraCargo;
@@ -735,9 +727,7 @@ namespace Barotrauma.Networking
msg.Write((UInt32)ExtraCargo.Count); msg.Write((UInt32)ExtraCargo.Count);
foreach (KeyValuePair<ItemPrefab, int> kvp in ExtraCargo) foreach (KeyValuePair<ItemPrefab, int> kvp in ExtraCargo)
{ {
msg.Write(kvp.Key.Identifier ?? ""); msg.Write(kvp.Key.Name); msg.Write((byte)kvp.Value);
msg.Write(kvp.Key.OriginalName ?? "");
msg.Write((byte)kvp.Value);
} }
} }
} }
@@ -176,6 +176,107 @@ namespace Barotrauma
} }
} }
public static string GetWithVariables(string textTag, string[] variableTags, string[] variableValues, bool[] formatCapitals = null, bool returnNull = false, string fallBackTag = null)
{
string text = Get(textTag, returnNull, fallBackTag);
if (text == null || text.Length == 0 || variableTags.Length != variableValues.Length)
{
#if DEBUG
if (variableTags.Length != variableValues.Length)
{
DebugConsole.ThrowError("variableTags.Length and variableValues.Length do not match for \"" + textTag + "\".");
}
if (formatCapitals != null && formatCapitals.Length != variableTags.Length)
{
DebugConsole.ThrowError("variableTags.Length and formatCapitals.Length do not match for \"" + textTag + "\".");
}
#endif
if (returnNull)
{
return null;
}
else
{
return textTag;
}
}
if (formatCapitals != null && !GameMain.Config.Language.Contains("Chinese"))
{
for (int i = 0; i < variableTags.Length; i++)
{
if (formatCapitals[i])
{
variableValues[i] = HandleVariableCapitalization(text, variableTags[i], variableValues[i]);
}
}
}
for (int i = 0; i < variableTags.Length; i++)
{
text = text.Replace(variableTags[i], variableValues[i]);
}
return text;
}
public static string GetWithVariable(string textTag, string variableTag, string variableValue, bool formatCapitals = false, bool returnNull = false, string fallBackTag = null)
{
string text = Get(textTag, returnNull, fallBackTag);
if (text == null || text.Length == 0)
{
if (returnNull)
{
return null;
}
else
{
return textTag;
}
}
if (formatCapitals && !GameMain.Config.Language.Contains("Chinese"))
{
variableValue = HandleVariableCapitalization(text, variableTag, variableValue);
}
return text.Replace(variableTag, variableValue);
}
private static string HandleVariableCapitalization(string text, string variableTag, string variableValue)
{
int index = text.IndexOf(variableTag) - 1;
if (index == -1)
{
return variableValue;
}
for (int i = index; i >= 0; i--)
{
if (text[i] == ' ')
{
continue;
}
else
{
if (text[i] != '.')
{
variableValue = variableValue.ToLower();
}
else
{
variableValue = Capitalize(variableValue);
break;
}
}
}
return variableValue;
}
public static string ParseInputTypes(string text) public static string ParseInputTypes(string text)
{ {
foreach (InputType inputType in Enum.GetValues(typeof(InputType))) foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
Binary file not shown.