2026-01-28 20:46:45 +05:30

46 lines
1.2 KiB
C#

using UnityEngine;
using UnityEngine.UI;
using TMPro;
using System.Collections;
public class GameHUDS : ScreenBase
{
[SerializeField] private Button diceBtn;
[SerializeField] private Button pauseBtn;
[Header("Text")]
[SerializeField] private TMP_Text diceCountText;
[SerializeField] private TMP_Text playerTurnText;
SoundManager soundManager;
private void OnEnable()
{
pauseBtn.onClick.AddListener(OnClick_pauseBtn);
diceBtn.onClick.AddListener(OnClick_diceBtn);
}
private void OnDisable()
{
pauseBtn.onClick.RemoveListener(OnClick_pauseBtn);
diceBtn.onClick.RemoveListener(OnClick_diceBtn);
}
private void OnClick_pauseBtn()
{
PopupManager popupManager = InterfaceManager.Instance?.GetInterfaceInstance<PopupManager>();
popupManager.ShowPopup(PopupType.PauseMenuPopup);
soundManager = soundManager == null ? InterfaceManager.Instance?.GetInterfaceInstance<SoundManager>() : soundManager;
soundManager?.PlayGameSoundClip(SoundType.ButtonClick);
Hide();
}
private void OnClick_diceBtn()
{
Dice dice = InterfaceManager.Instance?.GetInterfaceInstance<Dice>();
dice?.Roll();
}
}