[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>
This commit is contained in:
@@ -2,7 +2,7 @@ using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using YachtDice.Scoring;
|
||||
using YachtDice.Categories;
|
||||
|
||||
namespace YachtDice.UI
|
||||
{
|
||||
@@ -21,16 +21,16 @@ namespace YachtDice.UI
|
||||
[SerializeField] private Color previewPositiveColor = new Color(0.85f, 1f, 0.85f, 1f);
|
||||
[SerializeField] private Color previewZeroColor = new Color(1f, 0.88f, 0.88f, 1f);
|
||||
|
||||
private YachtCategory category;
|
||||
private CategoryDefinitionSO category;
|
||||
private bool isUsed;
|
||||
|
||||
public event Action<YachtCategory> OnCategorySelected;
|
||||
public event Action<CategoryDefinitionSO> OnCategorySelected;
|
||||
|
||||
public void Initialize(YachtCategory cat, string displayName)
|
||||
public void Initialize(CategoryDefinitionSO categoryDef)
|
||||
{
|
||||
category = cat;
|
||||
category = categoryDef;
|
||||
isUsed = false;
|
||||
categoryNameText.text = displayName;
|
||||
categoryNameText.text = categoryDef.DisplayName;
|
||||
previewText.text = "";
|
||||
recordedScoreText.text = "-";
|
||||
selectButton.onClick.AddListener(HandleClick);
|
||||
|
||||
Reference in New Issue
Block a user