Asset Loading Fix (#843)

* (hopefullyt) fix asset loading issue

* let mis-packed games load from res

timing display tweak

* fix initial pre-load not actually preloading needed games

fix mr upbeat metronome

* let's try this resyncing again
This commit is contained in:
minenice55
2024-04-08 22:01:18 -04:00
committed by minenice55
parent 3344220b7e
commit ef587c86bd
7 changed files with 113 additions and 85 deletions

View File

@ -386,8 +386,10 @@ namespace HeavenStudio
public bool usesAssetBundle => wantAssetBundle is not null or "";
public bool hasLocales => supportedLocales.Count > 0;
public bool AssetsLoaded => ((hasLocales && localeLoaded && currentLoadedLocale == defaultLocale) || (!hasLocales)) && commonLoaded && loadComplete;
public bool AssetsLoaded => ((hasLocales && localeLoaded && currentLoadedLocale == defaultLocale) || (!hasLocales)) && commonLoaded && (!loadingPrefab) && loadComplete;
public bool AlreadyLoading => alreadyLoading;
public bool LoadingPrefab => loadingPrefab;
public bool SequencesPreloaded => soundSequences != null;
public string LoadableName => inferred ? "noGame" : name;
public GameObject LoadedPrefab => loadedPrefab;
@ -401,6 +403,7 @@ namespace HeavenStudio
private bool localePreloaded = false;
private GameObject loadedPrefab = null;
bool loadingPrefab = false;
bool loadComplete = false;
private SoundSequence.SequenceKeyValue[] soundSequences = null;
@ -497,6 +500,7 @@ namespace HeavenStudio
if (alreadyLoading || AssetsLoaded || !usesAssetBundle) return;
loadComplete = false;
alreadyLoading = true;
loadingPrefab = true;
await UniTask.WhenAll(LoadCommonAssetBundleAsync(), LoadLocalizedAssetBundleAsync());
await UniTask.WhenAll(LoadGamePrefabAsync(), LoadCommonAudioClips(), LoadLocalizedAudioClips());
SoundByte.PreloadGameAudioClips(this);
@ -572,6 +576,7 @@ namespace HeavenStudio
soundSequences = minigame.SoundSequences;
}
loadedPrefab = prefab;
loadingPrefab = false;
}
public GameObject LoadGamePrefab()
@ -623,6 +628,7 @@ namespace HeavenStudio
}
SoundByte.UnloadAudioClips(name);
loadComplete = false;
loadingPrefab = false;
}
}