[Add] Universal modifier system, shop, inventory & persistence
Replace hardcoded BonusForOnes/MultiplierForSixes with data-driven modifier system supporting 2 scopes (SelectedCategory, AnyCategoryClosed), 4 effect types, durability modes (Permanent, LimitedUses), and configurable targets via ScriptableObject (ModifierData). - Modifier domain: ModifierEnums, ModifierTarget, ModifierData, ModifierRuntime, ModifierEffect (dict-based strategy), ModifierPipeline (4-pass: cat-additive → cat-multiplicative → final-additive → final-multiplicative) - ScoringSystem: replaced old modifier list with ModifierPipeline integration, added OnCategoryConfirmed event - Shop MVC: ShopCatalog (SO), ShopModel, ShopView, ShopItemView, ShopController - Inventory MVC: InventoryModel (activate/deactivate/sell/durability), InventoryView, InventorySlotView, InventoryController - CurrencyBank: editor-adjustable balance with events - Persistence: SaveData + SaveSystem (Newtonsoft JSON + PlayerPrefs) - Editor: ModifierAssetCreator menu item to generate 6 example modifiers + catalog - Tests: 6 test classes covering effects, pipeline, scoring, shop, inventory, save - GameController: wired shop/inventory/save lifecycle - GameInfoView: added currency display, shop/inventory toggle buttons Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,17 +8,31 @@ public sealed class GameInfoView : MonoBehaviour
|
||||
[Header("Turn Info")]
|
||||
[SerializeField] private TMP_Text turnText;
|
||||
|
||||
[Header("Currency")]
|
||||
[SerializeField] private TMP_Text currencyText;
|
||||
|
||||
[Header("Navigation")]
|
||||
[SerializeField] private Button shopButton;
|
||||
[SerializeField] private Button inventoryButton;
|
||||
|
||||
[Header("Game Over Overlay")]
|
||||
[SerializeField] private GameObject gameOverPanel;
|
||||
[SerializeField] private TMP_Text finalScoreText;
|
||||
[SerializeField] private Button newGameButton;
|
||||
|
||||
public event Action OnNewGameClicked;
|
||||
public event Action OnShopClicked;
|
||||
public event Action OnInventoryClicked;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
newGameButton.onClick.AddListener(() => OnNewGameClicked?.Invoke());
|
||||
gameOverPanel.SetActive(false);
|
||||
|
||||
if (shopButton != null)
|
||||
shopButton.onClick.AddListener(() => OnShopClicked?.Invoke());
|
||||
if (inventoryButton != null)
|
||||
inventoryButton.onClick.AddListener(() => OnInventoryClicked?.Invoke());
|
||||
}
|
||||
|
||||
public void SetTurnText(int turn, int maxTurns)
|
||||
@@ -26,6 +40,12 @@ public sealed class GameInfoView : MonoBehaviour
|
||||
turnText.text = $"Ход {turn} / {maxTurns}";
|
||||
}
|
||||
|
||||
public void SetCurrencyText(int amount)
|
||||
{
|
||||
if (currencyText != null)
|
||||
currencyText.text = amount.ToString();
|
||||
}
|
||||
|
||||
public void ShowGameOver(int finalScore)
|
||||
{
|
||||
gameOverPanel.SetActive(true);
|
||||
@@ -40,5 +60,10 @@ public sealed class GameInfoView : MonoBehaviour
|
||||
private void OnDestroy()
|
||||
{
|
||||
newGameButton.onClick.RemoveAllListeners();
|
||||
|
||||
if (shopButton != null)
|
||||
shopButton.onClick.RemoveAllListeners();
|
||||
if (inventoryButton != null)
|
||||
inventoryButton.onClick.RemoveAllListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user