[Add] Dice & Refactor private names
This commit is contained in:
@@ -8,14 +8,14 @@ namespace YachtDice.Shop
|
||||
{
|
||||
[SerializeField] private List<ScriptableObject> items = new();
|
||||
|
||||
private List<IShopItem> cachedItems;
|
||||
private List<IShopItem> _cachedItems;
|
||||
|
||||
public IReadOnlyList<IShopItem> All
|
||||
{
|
||||
get
|
||||
{
|
||||
if (cachedItems == null) RebuildCache();
|
||||
return cachedItems;
|
||||
if (_cachedItems == null) RebuildCache();
|
||||
return _cachedItems;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,14 +32,14 @@ namespace YachtDice.Shop
|
||||
|
||||
private void RebuildCache()
|
||||
{
|
||||
cachedItems = new List<IShopItem>();
|
||||
_cachedItems = new List<IShopItem>();
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
if (items[i] is IShopItem shopItem)
|
||||
cachedItems.Add(shopItem);
|
||||
_cachedItems.Add(shopItem);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnValidate() => cachedItems = null;
|
||||
private void OnValidate() => _cachedItems = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user