1774ab5b18
interact only after PopupItemMenu button clicked
35 lines
780 B
C#
35 lines
780 B
C#
using System;
|
|
using System.Collections;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class PopupItemMenu : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private Button _popupMenuItemButtonPrefab;
|
|
|
|
public void ShowButtons(Action menuButtonClick)
|
|
{
|
|
var button=Instantiate(_popupMenuItemButtonPrefab) as Button;
|
|
button.transform.SetParent(transform,false);
|
|
button.transform.localPosition = new Vector3(0, 100f, 0);
|
|
|
|
button.onClick.AddListener(() =>
|
|
{
|
|
menuButtonClick?.Invoke();
|
|
Hide();
|
|
CloseDialog();
|
|
});
|
|
}
|
|
private void CloseDialog()
|
|
{
|
|
UIManager.Instance.Unfreeze();
|
|
Destroy(this);
|
|
}
|
|
|
|
private void Hide()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|