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

This commit is contained in:
Joonas Rikkonen
2019-06-11 21:47:35 +03:00
parent 3b936e41ba
commit 3d57999f2d
@@ -40,6 +40,9 @@ namespace Barotrauma
{ {
ToolBox.IsProperFilenameCase(file); ToolBox.IsProperFilenameCase(file);
doc = XDocument.Load(file, LoadOptions.SetBaseUri); doc = XDocument.Load(file, LoadOptions.SetBaseUri);
if (doc == null) { throw new Exception("doc is null"); }
if (doc.Root == null) { throw new Exception("doc.Root is null"); }
if (doc.Root.Elements() == null) { throw new Exception("doc.Root.Elements() is null"); }
} }
catch (Exception e) catch (Exception e)
{ {
@@ -113,26 +116,34 @@ namespace Barotrauma
private void RescaleFonts() private void RescaleFonts()
{ {
if (configElement == null) { return; }
if (configElement.Elements() == null) { return; }
foreach (XElement subElement in configElement.Elements()) foreach (XElement subElement in configElement.Elements())
{ {
switch (subElement.Name.ToString().ToLowerInvariant()) switch (subElement.Name.ToString().ToLowerInvariant())
{ {
case "font": case "font":
if (Font == null) { continue; }
Font.Size = GetFontSize(subElement); Font.Size = GetFontSize(subElement);
break; break;
case "smallfont": case "smallfont":
if (SmallFont == null) { continue; }
SmallFont.Size = GetFontSize(subElement); SmallFont.Size = GetFontSize(subElement);
break; break;
case "largefont": case "largefont":
if (LargeFont == null) { continue; }
LargeFont.Size = GetFontSize(subElement); LargeFont.Size = GetFontSize(subElement);
break; break;
case "objectivetitle": case "objectivetitle":
if (ObjectiveTitleFont == null) { continue; }
ObjectiveTitleFont.Size = GetFontSize(subElement); ObjectiveTitleFont.Size = GetFontSize(subElement);
break; break;
case "objectivename": case "objectivename":
if (ObjectiveNameFont == null) { continue; }
ObjectiveNameFont.Size = GetFontSize(subElement); ObjectiveNameFont.Size = GetFontSize(subElement);
break; break;
case "videotitle": case "videotitle":
if (VideoTitleFont == null) { continue; }
VideoTitleFont.Size = GetFontSize(subElement); VideoTitleFont.Size = GetFontSize(subElement);
break; break;
} }