mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Remove unused sequential loading
This commit is contained in:
parent
827bf24339
commit
879b98bf2e
@ -124,10 +124,6 @@ public class SlideReelAsyncImageLoader
|
|||||||
{
|
{
|
||||||
public static SingletonSlideReelAsyncImageLoader Instance { get; private set; }
|
public static SingletonSlideReelAsyncImageLoader Instance { get; private set; }
|
||||||
|
|
||||||
private Queue<SlideReelAsyncImageLoader> _loaders = new();
|
|
||||||
|
|
||||||
private bool _isLoading;
|
|
||||||
|
|
||||||
public void Awake()
|
public void Awake()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
@ -137,36 +133,11 @@ public class SlideReelAsyncImageLoader
|
|||||||
private void OnSceneUnloaded(Scene _)
|
private void OnSceneUnloaded(Scene _)
|
||||||
{
|
{
|
||||||
StopAllCoroutines();
|
StopAllCoroutines();
|
||||||
_loaders.Clear();
|
|
||||||
_isLoading = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Load(SlideReelAsyncImageLoader loader)
|
public void Load(SlideReelAsyncImageLoader loader)
|
||||||
{
|
{
|
||||||
StartCoroutine(loader.DownloadTextures());
|
StartCoroutine(loader.DownloadTextures());
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Sequential
|
|
||||||
_loaders.Enqueue(loader);
|
|
||||||
if (!_isLoading)
|
|
||||||
{
|
|
||||||
StartCoroutine(Run());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator Run()
|
|
||||||
{
|
|
||||||
NHLogger.Log("Loading slide reels");
|
|
||||||
_isLoading = true;
|
|
||||||
while (_loaders.Count > 0)
|
|
||||||
{
|
|
||||||
var loader = _loaders.Dequeue();
|
|
||||||
yield return loader.DownloadTextures();
|
|
||||||
NHLogger.Log($"Finished a slide reel, {_loaders.Count} left");
|
|
||||||
}
|
|
||||||
_isLoading = false;
|
|
||||||
NHLogger.Log("Done loading slide reels");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user