(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
@@ -28,12 +28,11 @@ namespace Barotrauma
public readonly string[] AllowedContainerIdentifiers;
public readonly string[] AllowedContainerTags;
public ContainedItemSprite(XElement element, string path = "")
public ContainedItemSprite(XElement element, string path = "", bool lazyLoad = false)
{
Sprite = new Sprite(element, path);
Sprite = new Sprite(element, path, lazyLoad: lazyLoad);
AllowedContainerIdentifiers = element.GetAttributeStringArray("allowedcontaineridentifiers", new string[0], convertToLowerInvariant: true);
AllowedContainerTags = element.GetAttributeStringArray("allowedcontainertags", new string[0], convertToLowerInvariant: true);
}
public bool MatchesContainer(Item container)
@@ -101,9 +100,9 @@ namespace Barotrauma
/// </summary>
public List<PropertyConditional> AnimationConditionals { get; private set; } = new List<PropertyConditional>();
public DecorativeSprite(XElement element, string path = "")
public DecorativeSprite(XElement element, string path = "", bool lazyLoad = false)
{
Sprite = new Sprite(element, path);
Sprite = new Sprite(element, path, lazyLoad: lazyLoad);
SerializableProperty.DeserializeProperties(this, element);
foreach (XElement subElement in element.Elements())