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:
@@ -89,5 +89,22 @@ namespace YachtDice.Tests
|
||||
Assert.IsNotNull(loaded);
|
||||
Assert.AreEqual(0, loaded.Currency);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SaveAndLoad_RoundTrip_PreservesDiceIds()
|
||||
{
|
||||
var data = new SaveData
|
||||
{
|
||||
Currency = 100,
|
||||
OwnedDiceIds = new List<string> { "standard_d6", "chaos_d6" }
|
||||
};
|
||||
|
||||
SaveSystem.Save(data);
|
||||
var loaded = SaveSystem.Load();
|
||||
|
||||
Assert.AreEqual(2, loaded.OwnedDiceIds.Count);
|
||||
Assert.AreEqual("standard_d6", loaded.OwnedDiceIds[0]);
|
||||
Assert.AreEqual("chaos_d6", loaded.OwnedDiceIds[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user