mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Load all slides async
This commit is contained in:
parent
a946d87cdc
commit
50db88ecbe
@ -63,16 +63,6 @@ public class SlideReelAsyncImageLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator DownloadTextures()
|
|
||||||
{
|
|
||||||
foreach (var (index, path) in PathsToLoad)
|
|
||||||
{
|
|
||||||
NHLogger.LogVerbose($"Loaded slide reel {index} of {PathsToLoad.Count}");
|
|
||||||
|
|
||||||
yield return DownloadTexture(path, index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerator DownloadTexture(string url, int index)
|
private IEnumerator DownloadTexture(string url, int index)
|
||||||
{
|
{
|
||||||
var key = ImageUtilities.GetKey(url);
|
var key = ImageUtilities.GetKey(url);
|
||||||
@ -140,7 +130,12 @@ public class SlideReelAsyncImageLoader
|
|||||||
// Delay at least one frame to let things subscribe to the event before it fires
|
// Delay at least one frame to let things subscribe to the event before it fires
|
||||||
Delay.FireOnNextUpdate(() =>
|
Delay.FireOnNextUpdate(() =>
|
||||||
{
|
{
|
||||||
StartCoroutine(loader.DownloadTextures());
|
foreach (var (index, path) in loader.PathsToLoad)
|
||||||
|
{
|
||||||
|
NHLogger.LogVerbose($"Loaded slide reel {index} of {loader.PathsToLoad.Count}");
|
||||||
|
|
||||||
|
StartCoroutine(loader.DownloadTexture(path, index));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user