2024-10-06 23:41:09 +00:00
|
|
|
using Sirenix.OdinInspector;
|
2024-09-24 10:35:49 +00:00
|
|
|
using TMPro;
|
|
|
|
using UnityEngine;
|
2024-10-06 23:41:09 +00:00
|
|
|
using UnityEngine.UI;
|
2024-09-24 10:35:49 +00:00
|
|
|
|
|
|
|
namespace BlueWater.Uis
|
|
|
|
{
|
|
|
|
public class InteractionUi : MonoBehaviour
|
|
|
|
{
|
2024-10-06 23:41:09 +00:00
|
|
|
[SerializeField, Required]
|
2024-09-24 10:35:49 +00:00
|
|
|
private GameObject _panel;
|
2024-10-06 23:41:09 +00:00
|
|
|
|
2024-09-24 10:35:49 +00:00
|
|
|
[SerializeField]
|
2024-10-06 23:41:09 +00:00
|
|
|
private Image _fillImage;
|
|
|
|
|
|
|
|
[SerializeField, Required]
|
2024-09-24 10:35:49 +00:00
|
|
|
private TMP_Text _keyText;
|
|
|
|
|
2024-10-06 23:41:09 +00:00
|
|
|
[SerializeField, Required]
|
2024-09-24 10:35:49 +00:00
|
|
|
private TMP_Text _interactionText;
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
EventManager.OnShowInteractionUi += ShowUi;
|
|
|
|
EventManager.OnHideInteractionUi += HideUi;
|
2024-10-06 23:41:09 +00:00
|
|
|
EventManager.OnInteracting += A;
|
2024-09-24 10:35:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void OnDestroy()
|
|
|
|
{
|
|
|
|
EventManager.OnShowInteractionUi -= ShowUi;
|
|
|
|
EventManager.OnHideInteractionUi -= HideUi;
|
2024-10-06 23:41:09 +00:00
|
|
|
EventManager.OnInteracting -= A;
|
2024-09-24 10:35:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void ShowUi(string message)
|
|
|
|
{
|
|
|
|
_interactionText.text = message;
|
|
|
|
_panel.SetActive(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void HideUi()
|
|
|
|
{
|
|
|
|
_panel.SetActive(false);
|
|
|
|
}
|
2024-10-06 23:41:09 +00:00
|
|
|
|
|
|
|
private void A(float fillAmount)
|
|
|
|
{
|
|
|
|
_fillImage.fillAmount = fillAmount;
|
|
|
|
}
|
2024-09-24 10:35:49 +00:00
|
|
|
}
|
|
|
|
}
|