38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
using UnityEngine.UI;
|
|
|
|
namespace MedievalParty.MainMenu.Option
|
|
{
|
|
public class UI_OptionSection: MonoBehaviour
|
|
{
|
|
public static UI_OptionSection Instance { get; private set; }
|
|
|
|
public event EventHandler onExitTrigger;
|
|
|
|
[SerializeField] private Button exitButton;
|
|
|
|
private void Awake()
|
|
{
|
|
if (Instance)
|
|
{
|
|
Debug.LogWarning($"{typeof(UI_OptionSection)} already exist! {transform}");
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
|
|
Instance = this;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
exitButton.onClick.AddListener(() => onExitTrigger?.Invoke(this, EventArgs.Empty));
|
|
|
|
MainMenuManager.Instance.onSectionChange +=
|
|
(_, section) => gameObject.SetActive(section == MainMenuManager.Section.Option);
|
|
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
} |