UI update 02

This commit is contained in:
FloatGaming
2026-06-30 21:21:30 +08:00
parent b2a1e307a4
commit f62f643cfc
1666 changed files with 211081 additions and 22799 deletions
@@ -19,6 +19,11 @@ public static class DlcRemoteContentService
{
private void Start()
{
if (DlcRemoteManifestSyncService.ShouldDeferInitialRefresh())
{
return;
}
if (DlcRemoteContentService.autoRefreshOnStart)
{
DlcRemoteContentService.RefreshInstalledDlc();
@@ -144,42 +149,56 @@ public static class DlcRemoteContentService
state.retainedCatalogHandles.Add(catalogHandle);
if (manifest.entry.autoDownloadDependencies)
{
string[] dependencyKeys = manifest.entry.GetDependencyKeys();
for (int i = 0; i < dependencyKeys.Length; i++)
{
string dependencyKey = dependencyKeys[i];
if (string.IsNullOrWhiteSpace(dependencyKey))
{
continue;
}
AsyncOperationHandle downloadHandle = Addressables.DownloadDependenciesAsync(dependencyKey, false);
yield return downloadHandle;
if (downloadHandle.Status == AsyncOperationStatus.Succeeded)
{
state.retainedAssetHandles.Add(downloadHandle);
}
else
{
localSuccess = false;
Debug.LogWarning("[DLC] Failed to download dependencies for key '" + dependencyKey + "'.");
Addressables.Release(downloadHandle);
}
}
}
List<dlcData> loadedDlcs = new List<dlcData>();
List<SongData> loadedSongs = new List<SongData>();
List<SongDlcContentSO> loadedSongContents = new List<SongDlcContentSO>();
List<HeroSkinSO> loadedHeroSkins = new List<HeroSkinSO>();
List<AllyHero_SO> loadedHeroes = new List<AllyHero_SO>();
// Load the lightweight DLC metadata first so we can decide ownership
// before pulling (or even downloading) any heavy content.
yield return LoadAssetsByLabels(manifest.entry.GetDlcDataLabels(), loadedDlcs, state.retainedAssetHandles, result => localSuccess &= result);
yield return LoadAssetsByLabels(manifest.entry.GetSongLabels(), loadedSongs, state.retainedAssetHandles, result => localSuccess &= result);
yield return LoadAssetsByLabels(manifest.entry.GetSongContentLabels(), loadedSongContents, state.retainedAssetHandles, result => localSuccess &= result);
yield return LoadAssetsByLabels(manifest.entry.GetHeroSkinLabels(), loadedHeroSkins, state.retainedAssetHandles, result => localSuccess &= result);
bool owned = IsManifestEntryOwned(manifest, loadedDlcs);
if (owned)
{
if (manifest.entry.autoDownloadDependencies)
{
string[] dependencyKeys = manifest.entry.GetDependencyKeys();
for (int i = 0; i < dependencyKeys.Length; i++)
{
string dependencyKey = dependencyKeys[i];
if (string.IsNullOrWhiteSpace(dependencyKey))
{
continue;
}
AsyncOperationHandle downloadHandle = Addressables.DownloadDependenciesAsync(dependencyKey, false);
yield return downloadHandle;
if (downloadHandle.Status == AsyncOperationStatus.Succeeded)
{
state.retainedAssetHandles.Add(downloadHandle);
}
else
{
localSuccess = false;
Debug.LogWarning("[DLC] Failed to download dependencies for key '" + dependencyKey + "'.");
Addressables.Release(downloadHandle);
}
}
}
yield return LoadAssetsByLabels(manifest.entry.GetSongLabels(), loadedSongs, state.retainedAssetHandles, result => localSuccess &= result);
yield return LoadAssetsByLabels(manifest.entry.GetSongContentLabels(), loadedSongContents, state.retainedAssetHandles, result => localSuccess &= result);
yield return LoadAssetsByLabels(manifest.entry.GetHeroSkinLabels(), loadedHeroSkins, state.retainedAssetHandles, result => localSuccess &= result);
yield return LoadAssetsByLabels(manifest.entry.GetHeroLabels(), loadedHeroes, state.retainedAssetHandles, result => localSuccess &= result);
}
else
{
Debug.Log("[DLC] Skipping content load for unowned DLC '" + manifest.entry.GetSafeDlcKey() + "'. Only metadata is registered.");
}
DlcRuntimePackage package = new DlcRuntimePackage
{
@@ -190,13 +209,54 @@ public static class DlcRemoteContentService
dlcs = loadedDlcs.ToArray(),
songs = loadedSongs.ToArray(),
songContents = loadedSongContents.ToArray(),
heroSkins = loadedHeroSkins.ToArray()
heroSkins = loadedHeroSkins.ToArray(),
heroes = loadedHeroes.ToArray()
};
state.packages.Add(package);
reportResult?.Invoke(localSuccess);
}
private static bool IsManifestEntryOwned(DlcManifestRuntimeEntry manifest, List<dlcData> loadedDlcs)
{
// If any loaded dlcData asset reports owned, the package is owned. A DLC that
// does not enforce entitlement (builtInContent / requiresOwnership == false)
// is always owned via DlcOwnershipService.
if (loadedDlcs != null)
{
bool anyEnforced = false;
for (int i = 0; i < loadedDlcs.Count; i++)
{
dlcData dlc = loadedDlcs[i];
if (dlc == null)
{
continue;
}
anyEnforced = true;
if (DlcOwnershipService.IsDlcOwned(dlc))
{
return true;
}
}
if (anyEnforced)
{
return false;
}
}
// No dlcData asset was found for this manifest entry. Fall back to the manifest
// key so a remote/local ownership flag can still gate the content.
string key = manifest != null && manifest.entry != null ? manifest.entry.GetSafeDlcKey() : null;
if (string.IsNullOrWhiteSpace(key))
{
return true;
}
return DlcOwnershipService.IsDlcOwned(key);
}
private static IEnumerator LoadAssetsByLabels<T>(
string[] labels,
List<T> output,