43 lines
1.0 KiB
C#
43 lines
1.0 KiB
C#
using Sirenix.OdinInspector;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace BlueWater.Uis
|
|
{
|
|
public class UnlockUi : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private GameObject _panel;
|
|
|
|
[SerializeField]
|
|
private Image _image;
|
|
|
|
[SerializeField]
|
|
private TMP_Text _text;
|
|
|
|
private void Awake()
|
|
{
|
|
InitializeComponents();
|
|
}
|
|
|
|
[Button("컴포넌트 초기화")]
|
|
private void InitializeComponents()
|
|
{
|
|
_panel = transform.Find("Panel").gameObject;
|
|
_image = _panel.transform.Find("Image").GetComponent<Image>();
|
|
_text = _panel.transform.Find("Text").GetComponent<TMP_Text>();
|
|
}
|
|
|
|
public void ShowUi() => _panel.SetActive(true);
|
|
public void HideUi() => _panel.SetActive(false);
|
|
|
|
public void Initialize(Sprite sprite, int gold)
|
|
{
|
|
_image.sprite = sprite;
|
|
_text.text = gold.ToString("N0");
|
|
|
|
ShowUi();
|
|
}
|
|
}
|
|
} |