UI HUGE UPDATE
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public static class DlcContentAccess
|
||||
{
|
||||
public static bool IsSongAccessible(SongData song)
|
||||
{
|
||||
if (song == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dlcData owningDlc = SongDlcContentResolver.GetOwningDlc(song);
|
||||
return owningDlc == null || DlcOwnershipService.IsDlcOwned(owningDlc);
|
||||
}
|
||||
|
||||
public static bool IsSkinAccessible(HeroSkinResolvedData skin)
|
||||
{
|
||||
if (skin == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (skin.isBaseSkin || skin.unlockedByDefault)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(skin.sourceDlcId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return DlcOwnershipService.IsDlcOwned(skin.sourceDlcId);
|
||||
}
|
||||
|
||||
public static HeroSkinResolvedData GetAccessibleSelectedSkin(AllyHero_SO hero, bool fallbackToBase = true)
|
||||
{
|
||||
if (hero == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
HeroSkinResolvedData selected = hero.GetResolvedSelectedSkin(fallbackToBase);
|
||||
if (IsSkinAccessible(selected))
|
||||
{
|
||||
return selected;
|
||||
}
|
||||
|
||||
return fallbackToBase ? HeroSkinResolver.BuildBaseSkin(hero) : null;
|
||||
}
|
||||
|
||||
public static List<HeroSkinResolvedData> GetAccessibleSkinSet(AllyHero_SO hero, bool includeBaseSkin = true)
|
||||
{
|
||||
List<HeroSkinResolvedData> all = hero != null ? hero.GetResolvedSkinSet(includeBaseSkin) : new List<HeroSkinResolvedData>();
|
||||
List<HeroSkinResolvedData> result = new List<HeroSkinResolvedData>(all.Count);
|
||||
|
||||
for (int i = 0; i < all.Count; i++)
|
||||
{
|
||||
HeroSkinResolvedData skin = all[i];
|
||||
if (IsSkinAccessible(skin))
|
||||
{
|
||||
result.Add(skin);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user