(55318b678) Credits additions, made the "community actives" section a little more readable
This commit is contained in:
@@ -27,6 +27,9 @@ namespace Barotrauma
|
||||
case "text":
|
||||
AddTextElement(subElement, listBox.Content.RectTransform);
|
||||
break;
|
||||
case "gridtext":
|
||||
AddGridTextElement(subElement, listBox.Content.RectTransform);
|
||||
break;
|
||||
case "spacing":
|
||||
AddSpacingElement(subElement, listBox.Content.RectTransform);
|
||||
break;
|
||||
@@ -38,9 +41,9 @@ namespace Barotrauma
|
||||
listBox.UpdateScrollBarSize();
|
||||
}
|
||||
|
||||
private void AddTextElement(XElement element, RectTransform parent)
|
||||
private GUIComponent AddTextElement(XElement element, RectTransform parent, string overrideText = null, Anchor anchor = Anchor.Center)
|
||||
{
|
||||
var text = element.ElementInnerText().Replace(@"\n", "\n");
|
||||
var text = overrideText ?? element.ElementInnerText().Replace(@"\n", "\n");
|
||||
Color color = element.GetAttributeColor("color", Color.White);
|
||||
float scale = element.GetAttributeFloat("scale", 1.0f);
|
||||
Alignment alignment = Alignment.Center;
|
||||
@@ -69,7 +72,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
var textHolder = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.0f), parent), style: null);
|
||||
var textBlock = new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), textHolder.RectTransform, Anchor.Center),
|
||||
var textBlock = new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), textHolder.RectTransform, anchor),
|
||||
text,
|
||||
color,
|
||||
font,
|
||||
@@ -81,6 +84,32 @@ namespace Barotrauma
|
||||
textBlock.RectTransform.IsFixedSize = textHolder.RectTransform.IsFixedSize = true;
|
||||
textBlock.RectTransform.NonScaledSize = new Point(textBlock.Rect.Width, textBlock.Rect.Height);
|
||||
textHolder.RectTransform.NonScaledSize = new Point(textHolder.Rect.Width, textBlock.Rect.Height);
|
||||
return textHolder;
|
||||
}
|
||||
|
||||
private void AddGridTextElement(XElement element, RectTransform parent)
|
||||
{
|
||||
var text = element.ElementInnerText().Replace(@"\n", "\n");
|
||||
string[] elements = text.Split(',');
|
||||
RectTransform lineContainer = null;
|
||||
for (int i = 0; i < elements.Length; i++)
|
||||
{
|
||||
switch (i % 3)
|
||||
{
|
||||
case 0:
|
||||
lineContainer = AddTextElement(element, parent, elements[i], Anchor.CenterLeft).RectTransform;
|
||||
lineContainer.Anchor = Anchor.TopCenter;
|
||||
lineContainer.Pivot = Pivot.TopCenter;
|
||||
lineContainer.NonScaledSize = new Point((int)(parent.NonScaledSize.X * 0.7f), lineContainer.NonScaledSize.Y);
|
||||
break;
|
||||
case 1:
|
||||
AddTextElement(element, lineContainer, elements[i], Anchor.Center).GetChild<GUITextBlock>().TextAlignment = Alignment.Center;
|
||||
break;
|
||||
case 2:
|
||||
AddTextElement(element, lineContainer, elements[i], Anchor.CenterRight).GetChild<GUITextBlock>().TextAlignment = Alignment.CenterRight;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddSpacingElement(XElement element, RectTransform parent)
|
||||
|
||||
@@ -821,6 +821,54 @@ namespace Barotrauma
|
||||
VoiceSetting = voiceSetting;
|
||||
}
|
||||
}
|
||||
if (!SelectedContentPackages.Any())
|
||||
{
|
||||
var availablePackage = ContentPackage.List.FirstOrDefault(cp => cp.IsCompatible() && cp.CorePackage);
|
||||
if (availablePackage != null)
|
||||
{
|
||||
SelectedContentPackages.Add(availablePackage);
|
||||
}
|
||||
}
|
||||
|
||||
//save to get rid of the invalid selected packages in the config file
|
||||
if (missingPackagePaths.Count > 0 || incompatiblePackages.Count > 0) { SaveNewPlayerConfig(); }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Save DefaultConfig
|
||||
private void SaveNewDefaultConfig()
|
||||
{
|
||||
XDocument doc = new XDocument();
|
||||
|
||||
if (doc.Root == null)
|
||||
{
|
||||
doc.Add(new XElement("config"));
|
||||
}
|
||||
|
||||
doc.Root.Add(
|
||||
new XAttribute("language", TextManager.Language),
|
||||
new XAttribute("masterserverurl", MasterServerUrl),
|
||||
new XAttribute("autocheckupdates", AutoCheckUpdates),
|
||||
new XAttribute("musicvolume", musicVolume),
|
||||
new XAttribute("soundvolume", soundVolume),
|
||||
new XAttribute("voicechatvolume", voiceChatVolume),
|
||||
new XAttribute("verboselogging", VerboseLogging),
|
||||
new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs),
|
||||
new XAttribute("enablesplashscreen", EnableSplashScreen),
|
||||
new XAttribute("usesteammatchmaking", useSteamMatchmaking),
|
||||
new XAttribute("quickstartsub", QuickStartSubmarineName),
|
||||
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
|
||||
new XAttribute("aimassistamount", aimAssistAmount));
|
||||
|
||||
if (!ShowUserStatisticsPrompt)
|
||||
{
|
||||
doc.Root.Add(new XAttribute("senduserstatistics", sendUserStatistics));
|
||||
}
|
||||
|
||||
if (WasGameUpdated)
|
||||
{
|
||||
doc.Root.Add(new XAttribute("wasgameupdated", true));
|
||||
}
|
||||
|
||||
useSteamMatchmaking = doc.Root.GetAttributeBool("usesteammatchmaking", useSteamMatchmaking);
|
||||
requireSteamAuthentication = doc.Root.GetAttributeBool("requiresteamauthentication", requireSteamAuthentication);
|
||||
|
||||
Reference in New Issue
Block a user