UI update 02
This commit is contained in:
@@ -12,6 +12,7 @@ public sealed class DlcRuntimePackage
|
||||
public SongData[] songs = Array.Empty<SongData>();
|
||||
public SongDlcContentSO[] songContents = Array.Empty<SongDlcContentSO>();
|
||||
public HeroSkinSO[] heroSkins = Array.Empty<HeroSkinSO>();
|
||||
public AllyHero_SO[] heroes = Array.Empty<AllyHero_SO>();
|
||||
}
|
||||
|
||||
public static class DlcRuntimeRegistry
|
||||
@@ -25,11 +26,14 @@ public static class DlcRuntimeRegistry
|
||||
new Dictionary<string, SongDlcContentSO>(StringComparer.OrdinalIgnoreCase);
|
||||
private static readonly Dictionary<string, HeroSkinSO> HeroSkinsById =
|
||||
new Dictionary<string, HeroSkinSO>(StringComparer.OrdinalIgnoreCase);
|
||||
private static readonly Dictionary<int, AllyHero_SO> HeroesById =
|
||||
new Dictionary<int, AllyHero_SO>();
|
||||
|
||||
private static dlcData[] cachedDlcs = Array.Empty<dlcData>();
|
||||
private static SongData[] cachedSongs = Array.Empty<SongData>();
|
||||
private static SongDlcContentSO[] cachedSongContents = Array.Empty<SongDlcContentSO>();
|
||||
private static HeroSkinSO[] cachedHeroSkins = Array.Empty<HeroSkinSO>();
|
||||
private static AllyHero_SO[] cachedHeroes = Array.Empty<AllyHero_SO>();
|
||||
|
||||
public static event Action RuntimeContentChanged;
|
||||
|
||||
@@ -69,6 +73,11 @@ public static class DlcRuntimeRegistry
|
||||
return cachedHeroSkins;
|
||||
}
|
||||
|
||||
public static AllyHero_SO[] GetAllHeroes()
|
||||
{
|
||||
return cachedHeroes;
|
||||
}
|
||||
|
||||
public static void ReplaceAll(IList<DlcRuntimePackage> packages)
|
||||
{
|
||||
ClearSilently();
|
||||
@@ -97,10 +106,12 @@ public static class DlcRuntimeRegistry
|
||||
SongsById.Clear();
|
||||
SongContentsById.Clear();
|
||||
HeroSkinsById.Clear();
|
||||
HeroesById.Clear();
|
||||
cachedDlcs = Array.Empty<dlcData>();
|
||||
cachedSongs = Array.Empty<SongData>();
|
||||
cachedSongContents = Array.Empty<SongDlcContentSO>();
|
||||
cachedHeroSkins = Array.Empty<HeroSkinSO>();
|
||||
cachedHeroes = Array.Empty<AllyHero_SO>();
|
||||
}
|
||||
|
||||
private static void RegisterPackageInternal(DlcRuntimePackage package)
|
||||
@@ -185,6 +196,20 @@ public static class DlcRuntimeRegistry
|
||||
HeroSkinsById[skinId] = skin;
|
||||
}
|
||||
}
|
||||
|
||||
if (package.heroes != null)
|
||||
{
|
||||
for (int i = 0; i < package.heroes.Length; i++)
|
||||
{
|
||||
AllyHero_SO hero = package.heroes[i];
|
||||
if (hero == null || hero.ally_heroID <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
HeroesById[hero.ally_heroID] = hero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void RebuildSnapshots()
|
||||
@@ -200,5 +225,8 @@ public static class DlcRuntimeRegistry
|
||||
|
||||
cachedHeroSkins = new HeroSkinSO[HeroSkinsById.Count];
|
||||
HeroSkinsById.Values.CopyTo(cachedHeroSkins, 0);
|
||||
|
||||
cachedHeroes = new AllyHero_SO[HeroesById.Count];
|
||||
HeroesById.Values.CopyTo(cachedHeroes, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user