Rework shop to support multiple item types and add unified PlayerModel

Generalize the shop from selling only ModifierDefinition to any IShopItem
(modifiers + dice). Add purchase condition checks, hover tooltips, and
fixed prices. Introduce PlayerModel as a facade over CurrencyBank,
InventoryModel, and DiceCollection for centralized state and save/load.

New files:
- IShopItem interface for purchasable items
- ShopCatalog SO (unified catalog for all item types)
- ShopTooltipView (description on hover)
- PlayerModel (aggregates player state)
- DiceCollection (owned dice tracking)
- DiceCatalog SO (dice definition registry)
- DiceCollectionTests

Modified:
- ModifierDefinition/DieDefinitionSO implement IShopItem
- ShopModel/ShopView/ShopItemView/ShopController use IShopItem
- SaveData v3 with OwnedDiceIds
- GameController uses PlayerModel for save/load
- GameLifetimeScope registers new services

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 21:04:34 +07:00
parent 85d639aa70
commit fcceb0ce45
18 changed files with 576 additions and 54 deletions
@@ -1,11 +1,12 @@
using System.Collections.Generic;
using UnityEngine;
using YachtDice.Modifiers.Core;
using YachtDice.Shop;
namespace YachtDice.Modifiers.Definition
{
[CreateAssetMenu(fileName = "NewModifier", menuName = "YachtDice/Modifiers/Definition")]
public class ModifierDefinition : ScriptableObject
public class ModifierDefinition : ScriptableObject, IShopItem
{
[Header("Identity")]
[SerializeField] private string id;
@@ -36,6 +37,7 @@ namespace YachtDice.Modifiers.Definition
public bool HasLimitedUses => hasLimitedUses;
public int MaxUses => maxUses;
public int MaxStacks => maxStacks;
public bool IsRepurchasable => hasLimitedUses;
public IReadOnlyList<ModifierBehavior> Behaviors => behaviors;
#if UNITY_EDITOR