Exemplo n.º 1
0
        /// <summary>
        /// Display a popup message
        /// </summary>
        /// <param name="title">Title of the popup</param>
        /// <param name="message">Message of the popup</param>
        /// <param name="buttons">Buttons of the popup</param>
        /// <param name="buttonClickedCallback">Callback to call when a button has been clicked</param>
        /// <param name="data">Data to send to the popup</param>
        public void Popup(string title, string message, string[] buttons, PopupButtonClicked buttonClickedCallback = null, object data = null)
        {
            CurrentScreenGameObject.GetComponent <CanvasGroup>().blocksRaycasts = false;

            _popupGameObject.transform.SetAsLastSibling();

            UnityPopupScreen.Instance.Title   = title;
            UnityPopupScreen.Instance.Message = message;
            UnityPopupScreen.Instance.Buttons = buttons;
            UnityPopupScreen.Instance.Show(button =>
            {
                CurrentScreenGameObject.GetComponent <CanvasGroup>().blocksRaycasts = true;
                buttonClickedCallback?.Invoke(button);
            });
        }
Exemplo n.º 2
0
 private void NotifyAndCloseOnClick(string button)
 {
     _buttonClickedCallback?.Invoke(button);
     Hide();
 }
Exemplo n.º 3
0
 protected virtual void OnPopupButtonClicked(EventArgs e)
 {
     PopupButtonClicked?.Invoke(this, e);
 }