[Add] Dice & Refactor private names

This commit is contained in:
2026-03-02 11:22:01 +07:00
parent 4890fa946e
commit f65976796d
36 changed files with 883 additions and 489 deletions
+6 -6
View File
@@ -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;
}
}