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:
@@ -2,6 +2,7 @@ using UnityEngine;
|
||||
using VContainer;
|
||||
using VContainer.Unity;
|
||||
using YachtDice.Categories;
|
||||
using YachtDice.Dice;
|
||||
using YachtDice.Economy;
|
||||
using YachtDice.Events;
|
||||
using YachtDice.Game;
|
||||
@@ -9,6 +10,7 @@ using YachtDice.Inventory;
|
||||
using YachtDice.Modifiers.Definition;
|
||||
using YachtDice.Modifiers.Pipeline;
|
||||
using YachtDice.Modifiers.Runtime;
|
||||
using YachtDice.Player;
|
||||
using YachtDice.Scoring;
|
||||
using YachtDice.Shop;
|
||||
using YachtDice.UI;
|
||||
@@ -19,6 +21,8 @@ namespace YachtDice.DI
|
||||
{
|
||||
[SerializeField] private ModifierCatalog modifierCatalog;
|
||||
[SerializeField] private CategoryCatalog categoryCatalog;
|
||||
[SerializeField] private DiceCatalog diceCatalog;
|
||||
[SerializeField] private ShopCatalog shopCatalog;
|
||||
|
||||
[Header("Scene References")]
|
||||
[SerializeField] private ScoringSystem scoringSystem;
|
||||
@@ -37,6 +41,8 @@ namespace YachtDice.DI
|
||||
// SO catalogs
|
||||
builder.RegisterInstance(modifierCatalog);
|
||||
builder.RegisterInstance(categoryCatalog);
|
||||
builder.RegisterInstance(diceCatalog);
|
||||
builder.RegisterInstance(shopCatalog);
|
||||
|
||||
// Core modifier services
|
||||
builder.Register<ModifierRegistry>(Lifetime.Singleton)
|
||||
@@ -44,8 +50,14 @@ namespace YachtDice.DI
|
||||
builder.Register<ModifierPipeline>(Lifetime.Singleton);
|
||||
builder.Register<GameEventBus>(Lifetime.Singleton);
|
||||
|
||||
// Domain models
|
||||
// Player subsystems
|
||||
builder.Register<DiceCollection>(Lifetime.Singleton);
|
||||
builder.Register<InventoryModel>(Lifetime.Singleton);
|
||||
|
||||
// Unified player model
|
||||
builder.Register<PlayerModel>(Lifetime.Singleton);
|
||||
|
||||
// Shop
|
||||
builder.Register<ShopModel>(Lifetime.Singleton);
|
||||
|
||||
// Scene MonoBehaviour components
|
||||
|
||||
Reference in New Issue
Block a user