[Fix] Limited Use Modifier

This commit is contained in:
2026-03-05 09:52:26 +07:00
parent 72bbdc76af
commit 05c2619de4
7 changed files with 190 additions and 18 deletions
@@ -1,9 +1,7 @@
using UnityEngine;
using VContainer;
using YachtDice.Categories;
using YachtDice.Economy;
using YachtDice.Modifiers.Runtime;
using YachtDice.Scoring;
namespace YachtDice.Inventory
{
@@ -12,16 +10,14 @@ namespace YachtDice.Inventory
[SerializeField] private InventoryView inventoryView;
private InventoryModel _model;
private ScoringSystem _scoringSystem;
private CurrencyBank _currencyBank;
public InventoryModel Model => _model;
[Inject]
public void Construct(InventoryModel model, ScoringSystem scoringSystem, CurrencyBank currencyBank)
public void Construct(InventoryModel model, CurrencyBank currencyBank)
{
this._model = model;
this._scoringSystem = scoringSystem;
this._currencyBank = currencyBank;
}
@@ -32,7 +28,6 @@ namespace YachtDice.Inventory
inventoryView.OnSellClicked += HandleSell;
_model.OnInventoryChanged += HandleInventoryChanged;
_scoringSystem.OnCategoryConfirmed += HandleCategoryConfirmed;
RefreshView();
}
@@ -48,9 +43,6 @@ namespace YachtDice.Inventory
if (_model != null)
_model.OnInventoryChanged -= HandleInventoryChanged;
if (_scoringSystem != null)
_scoringSystem.OnCategoryConfirmed -= HandleCategoryConfirmed;
}
public void ToggleVisibility()
@@ -89,11 +81,6 @@ namespace YachtDice.Inventory
RefreshView();
}
private void HandleCategoryConfirmed(CategoryDefinition category, ScoreResult result)
{
_model.ConsumeUseOnActive();
}
private void RefreshView()
{
if (inventoryView != null && _model != null)