40 lines
868 B
C#
40 lines
868 B
C#
using System;
|
|
using BriarQueen.Data.Identifiers;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace BriarQueen.UI.Codex
|
|
{
|
|
public class CodexCategoryButton : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private Button _button;
|
|
|
|
public CodexType Category { get; private set; }
|
|
|
|
private void Awake()
|
|
{
|
|
if (_button != null)
|
|
_button.onClick.AddListener(HandleClicked);
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
if (_button != null)
|
|
_button.onClick.RemoveListener(HandleClicked);
|
|
}
|
|
|
|
public event Action<CodexType> OnCategoryClicked;
|
|
|
|
public void Initialize(CodexType category)
|
|
{
|
|
Category = category;
|
|
|
|
}
|
|
|
|
private void HandleClicked()
|
|
{
|
|
OnCategoryClicked?.Invoke(Category);
|
|
}
|
|
}
|
|
} |