(bc44f3622) Fixed credits not resizing when resolution is changed

This commit is contained in:
Joonas Rikkonen
2019-06-04 15:32:04 +03:00
parent 04932e960a
commit bc566ac0e7
18 changed files with 131 additions and 125 deletions
@@ -8,19 +8,32 @@ namespace Barotrauma
{
private GUIListBox listBox;
private readonly float scrollSpeed;
private XElement configElement;
private RectTransform parent;
private float scrollSpeed;
public CreditsPlayer(RectTransform rectT, string configFile) : base(null, rectT)
{
var doc = XMLExtensions.TryLoadXml(configFile);
scrollSpeed = doc.Root.GetAttributeFloat("scrollspeed", 100.0f);
int spacing = doc.Root.GetAttributeInt("spacing", 0);
GameMain.Instance.OnResolutionChanged += () => { ClearChildren(); Load(); };
listBox = new GUIListBox(new RectTransform(Vector2.One, rectT), style: null)
var doc = XMLExtensions.TryLoadXml(configFile);
configElement = doc.Root;
Load();
}
private void Load()
{
scrollSpeed = configElement.GetAttributeFloat("scrollspeed", 100.0f);
int spacing = configElement.GetAttributeInt("spacing", 0);
listBox = new GUIListBox(new RectTransform(Vector2.One, RectTransform), style: null)
{
Spacing = spacing
};
foreach (XElement subElement in doc.Root.Elements())
foreach (XElement subElement in configElement.Elements())
{
switch (subElement.Name.ToString().ToLowerInvariant())
{
@@ -967,7 +967,7 @@ namespace Barotrauma
{
try
{
OpenFileDialog ofd = new OpenFileDialog()
Barotrauma.OpenFileDialog ofd = new Barotrauma.OpenFileDialog()
{
Multiselect = true,
InitialDirectory = Path.GetFullPath(SteamManager.WorkshopItemStagingFolder),
@@ -1078,7 +1078,7 @@ namespace Barotrauma
{
try
{
OpenFileDialog ofd = new OpenFileDialog()
Barotrauma.OpenFileDialog ofd = new Barotrauma.OpenFileDialog()
{
InitialDirectory = Path.GetFullPath(SteamManager.WorkshopItemStagingFolder),
Title = TextManager.Get("workshopitemaddfiles"),
@@ -1074,7 +1074,7 @@ namespace Barotrauma
{
OnClicked = (btn, userdata) =>
{
OpenFileDialog ofd = new OpenFileDialog()
Barotrauma.OpenFileDialog ofd = new Barotrauma.OpenFileDialog()
{
InitialDirectory = Path.GetFullPath(Submarine.SavePath),
Filter = "PNG file|*.png",