Files
YachtDice/Assets/Scripts/DI/GameLifetimeScope.cs
T
horooko 0f9b162061 [Refactor] Replace hardcoded categories with data-driven SO system and abstract dice
- Add abstract dice system (IDie interface, DieDefinitionSO, StandardDieSO, DieInstance)
  to support future custom dice types while keeping backward compat via int[] DiceValues
- Replace YachtCategory enum and CategoryScorer switch with CategoryDefinitionSO hierarchy:
  SumOfValueCategorySO, NOfAKindCategorySO, FullHouseCategorySO, StraightCategorySO, SumAllCategorySO
- Add CategoryCatalogSO for ordered category collections and DiceCheckUtility for shared logic
- Refactor ScoringSystem, Views, GameManager, GameController to use SO references
- Update CategoryCondition modifier to use SO reference instead of enum
- Update all editor tests to use SO-based categories and DieInstance

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 11:46:50 +07:00

45 lines
1.5 KiB
C#

using UnityEngine;
using VContainer;
using VContainer.Unity;
using YachtDice.Categories;
using YachtDice.Economy;
using YachtDice.Events;
using YachtDice.Game;
using YachtDice.Modifiers.Definition;
using YachtDice.Modifiers.Pipeline;
using YachtDice.Modifiers.Runtime;
using YachtDice.Scoring;
namespace YachtDice.DI
{
public class GameLifetimeScope : LifetimeScope
{
[SerializeField] private ModifierCatalogSO modifierCatalog;
[SerializeField] private CategoryCatalogSO categoryCatalog;
[Header("Scene References")]
[SerializeField] private ScoringSystem scoringSystem;
[SerializeField] private CurrencyBank currencyBank;
[SerializeField] private GameManager gameManager;
[SerializeField] private DiceManager diceManager;
protected override void Configure(IContainerBuilder builder)
{
// SO catalogs
builder.RegisterInstance(modifierCatalog);
builder.RegisterInstance(categoryCatalog);
// Core modifier services
builder.Register<ModifierRegistry>(Lifetime.Singleton);
builder.Register<ModifierPipeline>(Lifetime.Singleton);
builder.Register<GameEventBus>(Lifetime.Singleton);
// Scene MonoBehaviour components
builder.RegisterComponent(scoringSystem);
builder.RegisterComponent(currencyBank);
builder.RegisterComponent(gameManager);
builder.RegisterComponent(diceManager);
}
}
}