[Fix] ScoringSystem

This commit is contained in:
2026-03-05 09:41:23 +07:00
parent dc901b9895
commit 72bbdc76af
3 changed files with 139 additions and 1 deletions
+14 -1
View File
@@ -5,6 +5,7 @@ using UnityEngine;
using VContainer;
using YachtDice.Categories;
using YachtDice.Dice;
using YachtDice.Economy;
using YachtDice.Events;
using YachtDice.Modifiers.Core;
using YachtDice.Modifiers.Runtime;
@@ -23,13 +24,19 @@ namespace YachtDice.Scoring
private GameEventBus _eventBus;
private ModifierRegistry _modifierRegistry;
private CategoryCatalog _catalog;
private CurrencyBank _currencyBank;
[Inject]
public void Construct(GameEventBus eventBus, ModifierRegistry modifierRegistry, CategoryCatalog catalog)
public void Construct(
GameEventBus eventBus,
ModifierRegistry modifierRegistry,
CategoryCatalog catalog,
CurrencyBank currencyBank)
{
this._eventBus = eventBus;
this._modifierRegistry = modifierRegistry;
this._catalog = catalog;
this._currencyBank = currencyBank;
}
public CategoryCatalog Catalog => _catalog;
@@ -109,6 +116,9 @@ namespace YachtDice.Scoring
_scorecard[category] = finalScore;
_usedCategories.Add(category);
if (context.CurrencyDelta != 0 && _currencyBank != null)
_currencyBank.Add(context.CurrencyDelta);
OnCategoryScored?.Invoke(category, finalScore);
OnCategoryConfirmed?.Invoke(category, result);
@@ -147,6 +157,9 @@ namespace YachtDice.Scoring
_scorecard[category] = finalScore;
_usedCategories.Add(category);
if (context != null && context.CurrencyDelta != 0 && _currencyBank != null)
_currencyBank.Add(context.CurrencyDelta);
OnCategoryScored?.Invoke(category, finalScore);
OnCategoryConfirmed?.Invoke(category, result);