d06ad78645
View layer: CategoryRowView (reusable x13 row with preview/recorded score display), ScoreCardView (full scorecard panel with Russian category names, upper bonus tracking), DicePanelView (5 dice buttons with lock toggle + roll counter), GameInfoView (turn display + game over overlay). Controller layer: GameController bridges Model and View — subscribes to model events in Awake() to catch GameManager.Start(), routes UI clicks to game logic, computes preview scores for all unfilled categories after each roll, handles upper section bonus (63+ = +35). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
45 lines
1.0 KiB
C#
45 lines
1.0 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
|
|
public sealed class GameInfoView : MonoBehaviour
|
|
{
|
|
[Header("Turn Info")]
|
|
[SerializeField] private TMP_Text turnText;
|
|
|
|
[Header("Game Over Overlay")]
|
|
[SerializeField] private GameObject gameOverPanel;
|
|
[SerializeField] private TMP_Text finalScoreText;
|
|
[SerializeField] private Button newGameButton;
|
|
|
|
public event Action OnNewGameClicked;
|
|
|
|
private void Awake()
|
|
{
|
|
newGameButton.onClick.AddListener(() => OnNewGameClicked?.Invoke());
|
|
gameOverPanel.SetActive(false);
|
|
}
|
|
|
|
public void SetTurnText(int turn, int maxTurns)
|
|
{
|
|
turnText.text = $"Ход {turn} / {maxTurns}";
|
|
}
|
|
|
|
public void ShowGameOver(int finalScore)
|
|
{
|
|
gameOverPanel.SetActive(true);
|
|
finalScoreText.text = $"Итого: {finalScore}";
|
|
}
|
|
|
|
public void HideGameOver()
|
|
{
|
|
gameOverPanel.SetActive(false);
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
newGameButton.onClick.RemoveAllListeners();
|
|
}
|
|
}
|