v0.10.5.1

This commit is contained in:
Juan Pablo Arce
2020-09-22 11:31:56 -03:00
parent 44032d0ae0
commit 0002ad2c50
343 changed files with 12276 additions and 5023 deletions
@@ -4,6 +4,7 @@ using System;
using Barotrauma.IO;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Barotrauma
{
@@ -11,6 +12,8 @@ namespace Barotrauma
{
private bool cannotBeLoaded;
protected volatile bool loadingAsync = false;
protected Texture2D texture;
public Texture2D Texture
{
@@ -64,9 +67,17 @@ namespace Barotrauma
if (sourceVector.W == 0.0f) sourceVector.W = texture.Height;
}
public void EnsureLazyLoaded()
public async Task LazyLoadAsync()
{
if (!LazyLoad || texture != null || cannotBeLoaded) { return; }
await Task.Yield();
if (!LazyLoad || texture != null || cannotBeLoaded || loadingAsync) { return; }
EnsureLazyLoaded(isAsync: true);
}
public void EnsureLazyLoaded(bool isAsync=false)
{
if (!LazyLoad || texture != null || cannotBeLoaded || loadingAsync) { return; }
loadingAsync = isAsync;
Vector4 sourceVector = Vector4.Zero;
bool temp2 = false;