(c445db0f5) Lazy load item & structure sprites (loaded automatically when switching to the sub editor or instantiating an item/structure, so should not cause any mid-game freezes).

This commit is contained in:
Joonas Rikkonen
2019-04-04 11:09:32 +03:00
parent 66fa81bd3d
commit 1966bcb4ab
22 changed files with 133 additions and 584 deletions
@@ -70,7 +70,6 @@ namespace Barotrauma
private GUIImage(RectTransform rectT, Sprite sprite, Rectangle? sourceRect, bool scaleToFit, string style) : base(style, rectT)
{
this.scaleToFit = scaleToFit;
sprite?.EnsureLazyLoaded();
Sprite = sprite;
if (sourceRect.HasValue)
{
@@ -506,7 +506,7 @@ namespace Barotrauma
{
if (ScrollBar.IsHorizontal)
{
if (pos + child.Rect.Height + spacing > Content.Rect.Height)
if (pos + child.Rect.Height + spacing > Content.Rect.Height || child == children.Last())
{
pos = 0;
totalSize += child.Rect.Width + spacing;
@@ -515,14 +515,10 @@ namespace Barotrauma
{
pos += child.Rect.Height + spacing;
}
if (child == children.Last())
{
totalSize += child.Rect.Width + spacing;
}
}
else
{
if (pos + child.Rect.Width + spacing > Content.Rect.Width)
if (pos + child.Rect.Width + spacing > Content.Rect.Width || child == children.Last())
{
pos = 0;
totalSize += child.Rect.Height + spacing;
@@ -531,11 +527,6 @@ namespace Barotrauma
{
pos += child.Rect.Width + spacing;
}
if (child == children.Last())
{
totalSize += child.Rect.Height + spacing;
}
}
}
}