(975eacb57) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev

This commit is contained in:
Joonas Rikkonen
2019-05-07 16:23:16 +03:00
parent bb6067df31
commit 482f3c1f3c
24 changed files with 200 additions and 97 deletions
@@ -84,8 +84,12 @@
<Submarine file="Submarines/Remora.sub" />
<Submarine file="Submarines/RemoraDrone.sub" />
<Text file="Content/Texts/EnglishVanilla.xml" />
<Text file="Content/Texts/RussianVanillaTest.xml" />
<Text file="Content/Texts/ChineseVanillaTest.xml" />
<Text file="Content/Texts/GermanVanilla.xml" />
<Text file="Content/Texts/FrenchVanilla.xml" />
<Text file="Content/Texts/RussianVanilla.xml" />
<Text file="Content/Texts/BrazilianPortugueseVanilla.xml" />
<Text file="Content/Texts/SimplifiedChineseVanilla.xml" />
<Text file="Content/Texts/TraditionalChineseVanilla.xml" />
<UIStyle file="Content/UI/style.xml"/>
<Afflictions file="Content/Afflictions.xml"/>
<Structure file="Content/Map/StructurePrefabs.xml" />
@@ -361,6 +361,12 @@
<Content Include="$(MSBuildThisFileDirectory)Content\Effects\waterbump.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Fonts\NotoSans\NotoSansCJKsc-Bold.otf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Fonts\NotoSans\NotoSansCJKsc-Medium.otf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Fonts\NotoSans\NotoSansTC-Bold.otf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -499,10 +505,25 @@
<Content Include="$(MSBuildThisFileDirectory)Content\Map\OutpostWall_C.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Texts\ChineseVanillaTest.xml">
<Content Include="$(MSBuildThisFileDirectory)Content\Texts\BrazilianPortugueseVanilla.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Texts\RussianVanillaTest.xml">
<Content Include="$(MSBuildThisFileDirectory)Content\Texts\Credits.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Texts\FrenchVanilla.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Texts\GermanVanilla.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Texts\RussianVanilla.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Texts\SimplifiedChineseVanilla.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Texts\TraditionalChineseVanilla.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_command.mp4">
@@ -556,6 +577,9 @@
<Content Include="$(MSBuildThisFileDirectory)Content\UI\tutorialAtlas.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="$(MSBuildThisFileDirectory)Concentus_LICENSE">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)Content\Fonts\BebasNeue-Regular.otf">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
@@ -109,6 +109,11 @@ namespace Barotrauma
if (!ParseTexturePath(path, file)) { return; }
Name = SourceElement.GetAttributeString("name", null);
Vector4 sourceVector = SourceElement.GetAttributeVector4("sourcerect", Vector4.Zero);
var overrideElement = GetLocalizationOverrideElement();
if (overrideElement != null && overrideElement.Attribute("sourcerect") != null)
{
sourceVector = overrideElement.GetAttributeVector4("sourcerect", Vector4.Zero);
}
preMultipliedAlpha = preMultiplyAlpha ?? SourceElement.GetAttributeBool("premultiplyalpha", true);
bool shouldReturn = false;
if (!lazyLoad)
@@ -240,8 +245,12 @@ namespace Barotrauma
}
if (SourceElement != null)
{
Vector4 sourceVector = SourceElement.GetAttributeVector4("sourcerect", Vector4.Zero);
sourceRect = new Rectangle((int)sourceVector.X, (int)sourceVector.Y, (int)sourceVector.Z, (int)sourceVector.W);
sourceRect = SourceElement.GetAttributeRect("sourcerect", Rectangle.Empty);
var overrideElement = GetLocalizationOverrideElement();
if (overrideElement != null && overrideElement.Attribute("sourcerect") != null)
{
sourceRect = overrideElement.GetAttributeRect("sourcerect", Rectangle.Empty);
}
size = SourceElement.GetAttributeVector2("size", Vector2.One);
size.X *= sourceRect.Width;
size.Y *= sourceRect.Height;
@@ -256,6 +265,12 @@ namespace Barotrauma
if (file == "")
{
file = SourceElement.GetAttributeString("texture", "");
var overrideElement = GetLocalizationOverrideElement();
if (overrideElement != null)
{
string overrideFile = overrideElement.GetAttributeString("texture", "");
if (!string.IsNullOrEmpty(overrideFile)) { file = overrideFile; }
}
}
if (file == "")
{
@@ -273,6 +288,22 @@ namespace Barotrauma
}
return true;
}
private XElement GetLocalizationOverrideElement()
{
foreach (XElement subElement in SourceElement.Elements())
{
if (subElement.Name.ToString().ToLowerInvariant() == "override")
{
string language = subElement.GetAttributeString("language", "");
if (TextManager.Language.ToLower() == language.ToLower())
{
return subElement;
}
}
}
return null;
}
}
}
@@ -16,14 +16,6 @@ namespace Barotrauma
private static string[] serverMessageCharacters = new string[] { "~", "[", "]", "=" };
public static string Language;
public static bool NoWhiteSpace
{
get
{
if (!textPacks.ContainsKey(Language)) { return false; }
return textPacks[Language].Any(t => t.NoWhiteSpace);
}
}
private static HashSet<string> availableLanguages = new HashSet<string>();
public static IEnumerable<string> AvailableLanguages
@@ -11,9 +11,7 @@ namespace Barotrauma
public readonly string Language;
private Dictionary<string, List<string>> texts;
public readonly bool NoWhiteSpace;
private readonly string filePath;
public TextPack(string filePath)
@@ -25,7 +23,6 @@ namespace Barotrauma
if (doc == null || doc.Root == null) return;
Language = doc.Root.GetAttributeString("language", "Unknown");
NoWhiteSpace = doc.Root.GetAttributeBool("nowhitespace", false);
foreach (XElement subElement in doc.Root.Elements())
{
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.