bee20fd1f8
Wrap all 39 scripts and 6 test files in namespaces matching their folder structure (e.g. Assets/Scripts/Dice/ → YachtDice.Dice). Add cross-namespace using directives where types are referenced across modules. Set rootNamespace in both .asmdef files (YachtDice, YachtDice.Tests). Namespace mapping: - YachtDice.Dice — Dice, DiceRoller - YachtDice.Economy — CurrencyBank - YachtDice.Game — GameManager, DiceManager, DebugGameInput - YachtDice.Inventory — InventoryController/Model/SlotView/View - YachtDice.Modifiers — ModifierData/Effect/Enums/Pipeline/Runtime/Target - YachtDice.Persistence — SaveData, SaveSystem - YachtDice.Scoring — CategoryScorer, ScoreResult, ScoringSystem, YachtCategory - YachtDice.Shop — ShopCatalog/Controller/ItemView/Model/View - YachtDice.UI — CategoryRowView, DicePanelView, GameController, GameInfoView, ScoreCardView - YachtDice.Editor — ModifierAssetCreator - YachtDice.Tests — all test files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
74 lines
1.9 KiB
C#
74 lines
1.9 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
|
|
namespace YachtDice.UI
|
|
{
|
|
|
|
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)
|
|
{
|
|
turnText.text = $"Ход {turn} / {maxTurns}";
|
|
}
|
|
|
|
public void SetCurrencyText(int amount)
|
|
{
|
|
if (currencyText != null)
|
|
currencyText.text = amount.ToString();
|
|
}
|
|
|
|
public void ShowGameOver(int finalScore)
|
|
{
|
|
gameOverPanel.SetActive(true);
|
|
finalScoreText.text = $"Итого: {finalScore}";
|
|
}
|
|
|
|
public void HideGameOver()
|
|
{
|
|
gameOverPanel.SetActive(false);
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
newGameButton.onClick.RemoveAllListeners();
|
|
|
|
if (shopButton != null)
|
|
shopButton.onClick.RemoveAllListeners();
|
|
if (inventoryButton != null)
|
|
inventoryButton.onClick.RemoveAllListeners();
|
|
}
|
|
}
|
|
}
|