Esempio 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);
            });
        }
Esempio n. 2
0
 public void Hide()
 {
     _buttonClickedCallback = null;
     StartCoroutine(_Hide());
 }
Esempio n. 3
0
 public virtual void Show(PopupButtonClicked buttonClickedCallback = null, object data = null)
 {
     _buttonClickedCallback = buttonClickedCallback;
     gameObject.SetActive(true);
     StartCoroutine(transform.GetChild(0).Scale(Vector3.zero, Vector3.one, 0.25f));
 }
Esempio n. 4
0
 protected virtual void OnPopupButtonClicked(EventArgs e)
 {
     PopupButtonClicked?.Invoke(this, e);
 }
Esempio n. 5
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="button">Button 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 button, PopupButtonClicked buttonClickedCallback = null, object data = null)
 {
     Popup(title, message, new [] { button }, buttonClickedCallback, data);
 }
Esempio n. 6
0
 /// <summary>
 /// Display a popup message with OK and Cancel buttons
 /// </summary>
 /// <param name="title">Title of the popup</param>
 /// <param name="message">Message of the popup</param>
 /// <param name="buttonClickedCallback">Callbakc to call when a button has been clicked</param>
 /// <param name="data">Data to send to the popup</param>
 public void PopupOkCancel(string title, string message, PopupButtonClicked buttonClickedCallback = null, object data = null)
 {
     Popup(title, message, new[] { "Ok", "Cancel" }, buttonClickedCallback);
 }