(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:
@@ -38,9 +38,6 @@ namespace Barotrauma
|
||||
|
||||
SerializableProperty.DeserializeProperties(this, configElement);
|
||||
|
||||
name = TextManager.Get("EntityName." + identifier, returnNull: true) ?? name;
|
||||
Description = TextManager.Get("EntityDescription." + identifier, returnNull: true) ?? Description;
|
||||
|
||||
int minX = int.MaxValue, minY = int.MaxValue;
|
||||
int maxX = int.MinValue, maxY = int.MinValue;
|
||||
DisplayEntities = new List<Pair<MapEntityPrefab, Rectangle>>();
|
||||
|
||||
@@ -276,9 +276,10 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
StairDirection = Prefab.StairDirection;
|
||||
|
||||
SerializableProperties = SerializableProperty.GetProperties(this);
|
||||
|
||||
|
||||
InitProjSpecific();
|
||||
|
||||
if (Prefab.Body)
|
||||
{
|
||||
Bodies = new List<Body>();
|
||||
@@ -307,6 +308,8 @@ namespace Barotrauma
|
||||
InsertToList();
|
||||
}
|
||||
|
||||
partial void InitProjSpecific();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace Barotrauma
|
||||
switch (subElement.Name.ToString())
|
||||
{
|
||||
case "sprite":
|
||||
sp.sprite = new Sprite(subElement);
|
||||
sp.sprite = new Sprite(subElement, lazyLoad: true);
|
||||
if (subElement.Attribute("sourcerect") == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Warning - sprite sourcerect not configured for structure \"" + sp.name + "\"!");
|
||||
@@ -193,7 +193,7 @@ namespace Barotrauma
|
||||
sp.sprite.EntityID = sp.identifier;
|
||||
break;
|
||||
case "backgroundsprite":
|
||||
sp.BackgroundSprite = new Sprite(subElement);
|
||||
sp.BackgroundSprite = new Sprite(subElement, lazyLoad: true);
|
||||
|
||||
if (subElement.GetAttributeBool("fliphorizontal", false))
|
||||
sp.BackgroundSprite.effects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Reference in New Issue
Block a user