Exemplo n.º 1
0
        /// <summary>
        /// Add listner and show pop
        /// </summary>
        private void Start()
        {
            //Disable Dev mode button listner
            m_DisableDevModeButton.onClick.AddListener(() =>
            {
                PopupHandler.ShowPopup("DISABLE_DEV_MODE", "OK", "QUIT", "", false, (PopUpButtonCallback _popCall) =>
                {
                    if (_popCall == PopUpButtonCallback.LEFT)
                    {
                        Debug.Log("Disable dev mode called here. Left");
                    }
                    else if (_popCall == PopUpButtonCallback.RIGHT)
                    {
                        Debug.Log("Disable dev mode called here. Right");
                    }
                });
            });

            //Alreay Register button listner
            m_AlreadyRegisterdButton.onClick.AddListener(() =>
            {
                PopupHandler.ShowPopup("ALREADY_REGISTERED", "LOGIN", "REGISTER", "", false, (PopUpButtonCallback _popCall) =>
                {
                    Debug.Log("ALREADY_REGISTERED called here.");
                });
            });

            //Location button listner
            m_LocationAccess.onClick.AddListener(() =>
            {
                PopupHandler.ShowPopupWithParams("LOCATION_ACCESS", "SETTING", "", true, (PopUpButtonCallback _popCall) =>
                {
                    Debug.Log("LOCATION_ACCESS called here.");
                });
            });

            //Hide all popup
            m_HideAll.onClick.AddListener(() =>
            {
                PopupHandler.Hide();
            });

            //Load main scene
            m_BackButton.onClick.AddListener(() =>
            {
                SceneManager.LoadScene("MainScene");
            });
        }
Exemplo n.º 2
0
    public void ShowPopup(string heading, string msg, string positiveBtnTxt, string negativeBtnTxt,
                          UnityAction positiveBtnAction, UnityAction negativeBtnAction, UnityAction closeBtnAction)
    {
        if (popup == null)
        {
            popup        = Instantiate(popupPrefab);
            popupHandler = popup.GetComponent <PopupHandler> ();
        }

        if (popupHandler != null)
        {
            popupHandler.SetHeading(heading);
            popupHandler.SetMessage(msg);
            popupHandler.SetPositiveBtnTxt(positiveBtnTxt);
            popupHandler.SetNegativeBtnTxt(negativeBtnTxt);

            if (positiveBtnAction == null)
            {
                popupHandler.HidePositiveBtn();
            }
            else
            {
                popupHandler.SetPositiveBtnAction(positiveBtnAction);
            }

            if (negativeBtnAction == null)
            {
                popupHandler.HideNegativeBtn();
            }
            else
            {
                popupHandler.SetNegativeBtnAction(negativeBtnAction);
            }

            if (closeBtnAction == null)
            {
                popupHandler.HideCloseBtn();
            }
            else
            {
                popupHandler.SetCloseBtnAction(closeBtnAction);
            }

            popupHandler.ShowPopup();
        }
    }