Example #1
0
    void OnClientReceivePopup(NetworkMessage netMsg)
    {
        ErrorMsg message = netMsg.ReadMessage <ErrorMsg>();

        print("OnClientReceivePopup: " + message.text);

        // show a popup
        uiPopup.Show(message.text);

        // disconnect if it was an important network error
        // (this is needed because the login failure message doesn't disconnect
        //  the client immediately (only after timeout))
        if (message.causesDisconnect)
        {
            netMsg.conn.Disconnect();

            // also stop the host if running as host
            // (host shouldn't start server but disconnect client for invalid
            //  login, which would be pointless)
            if (NetworkServer.active)
            {
                StopHost();
            }
        }
    }
 void OnClientError(NetworkConnection conn, ErrorMsg message)
 {
     print("OnClientError: " + message.text);
     uiPopup.Show(message.text);
     if (message.causesDisconnect)
     {
         conn.Disconnect();
         if (NetworkServer.active)
         {
             StopHost();
         }
     }
 }
Example #3
0
    public virtual void Destroy()
    {
        if (null == gameObject || !gameObject.activeSelf)
        {
            return;
        }

        if (UIManager.a.IsSound)
        {
            Sound.Play("");// ("Meta_se_button_5");
        }
        if (OnBackEvent != null)
        {
            OnBackEvent();
        }

        UIPopup pre = UIManager.a.GetPrePopup();

        if (pre != null)
        {
            pre.Show();
        }

        Destroy(gameObject);
    }
Example #4
0
    private IEnumerator ShowControls(float waitTime)
    {
        yield return(new WaitForSeconds(waitTime));

        ControlsPopUp.enabled = true;
        ControlsPopUp.Show();
    }
Example #5
0
    public void ShowPopup(ePopupType type, string title, string content, System.Action <bool> callback)
    {
        GameObject popupObj = (GameObject)Instantiate(m_PopupPrefab, m_Canvas.transform);

        popupObj.transform.SetSiblingIndex(0);                  // make sure it doesn't show up over the Fade Scrim
        m_CurrentPopup     = popupObj.GetComponent <UIPopup>(); // TODO should probably use a stack for easily managing multiple popups
        m_CurrentPopupType = type;
        m_CloseCallback    = callback;

        List <UIPromptInfo> prompts = new List <UIPromptInfo>()
        {
            m_Prompts[0]
        };

        switch (m_CurrentPopupType)
        {
        case ePopupType.Confirm:
            m_Prompts[0].m_LabelText = "Okay";
            break;

        case ePopupType.YesNo:
            m_Prompts[0].m_LabelText = "Yes";
            m_Prompts[1].m_LabelText = "No";

            prompts.Add(m_Prompts[1]);
            break;
        }

        m_CurrentPopup.SetData(title, content, prompts);
        m_CurrentPopup.Show();

        InputManager.Instance.AddInputEventDelegate(OnInputUpdate, UpdateLoopType.Update);
    }
        public void ShowPopup()
        {
            //get a clone of the UIPopup, with the given PopupName, from the UIPopup Database
            UIPopup popup = UIPopup.GetPopup(PopupName);

            //make sure that a popup clone was actually created
            if (popup == null)
            {
                return;
            }

            //we assume (because we know) this UIPopup has a Title and a Message text objects referenced, thus we set their values
            popup.Data.SetLabelsTexts(Title, Message);

            //update the hide settings
            popup.HideOnBackButton     = HideOnBackButton;
            popup.HideOnClickAnywhere  = HideOnClickAnywhere;
            popup.HideOnClickOverlay   = HideOnClickOverlay;
            popup.HideOnClickContainer = HideOnClickContainer;

            //if the developer did not enable at least one hide option, make the UIPopup automatically hide itself (to avoid blocking the UI)
            if (!HideOnBackButton && !HideOnClickAnywhere && !HideOnClickOverlay && !HideOnClickContainer)
            {
                popup.AutoHideAfterShow      = true;
                popup.AutoHideAfterShowDelay = 3f;
                DDebug.Log("Popup '" + PopupName + "' is set to auto-hide in " + popup.AutoHideAfterShowDelay + " seconds because you did not enable any hide option");
            }

            popup.Show(); //show the popup
        }
Example #7
0
    public void ShowFailedPopup()
    {
        _popup = GameObject.Instantiate(gameOverPopup, _gameManager.masterCanvas.transform);
        Button button = _popup.transform.GetChild(1).GetChild(2).GetComponent <Button>();

        button.onClick.AddListener(this.hidePopup);
        _popup.Show();
    }
Example #8
0
    public void ActivePopupMessage(string _strtTitle, string _strMessage)
    {
        txtMessage.text = _strMessage;
        txtTitle.text   = _strtTitle;

        //this.gameObject.SetActive(true);
        uIPopup.Show();
    }
Example #9
0
    private void PrevPopupActive(bool isActive_)
    {
        UIPopup popup = GetTopPopup();

        if (popup != null)
        {
            popup.Show();
            //popup.transform.Show();
        }
    }
Example #10
0
    void Update()
    {
        if (manager.state == NetworkState.Offline || manager.state == NetworkState.Handshake)
        {
            panel.SetActive(true);

            // status
            if (manager.IsConnecting())
            {
                statusText.text = "Connecting...";
            }
            else if (manager.state == NetworkState.Handshake)
            {
                statusText.text = "Handshake...";
            }
            else
            {
                statusText.text = "";
            }

            registerButton.interactable = !manager.isNetworkActive;
            registerButton.onClick.SetListener(() => { uiPopup.Show(registerMessage); });
            loginButton.interactable = !manager.isNetworkActive && auth.IsAllowedAccountName(accountInput.text);
            loginButton.onClick.SetListener(() => { manager.StartClient(); });
            hostButton.interactable = Application.platform != RuntimePlatform.WebGLPlayer && !manager.isNetworkActive && auth.IsAllowedAccountName(accountInput.text);
            hostButton.onClick.SetListener(() => {
                Debug.Log("hostButton fue presionado antes del statrHost");
                manager.StartHost();
                Debug.Log("hostButton fue presionado despues del statrHost");
            });
            cancelButton.gameObject.SetActive(manager.IsConnecting());
            cancelButton.onClick.SetListener(() => { manager.StopClient(); });
            dedicatedButton.interactable = Application.platform != RuntimePlatform.WebGLPlayer && !manager.isNetworkActive;
            dedicatedButton.onClick.SetListener(() => {
                Debug.Log("dedicateButton fue presionado antes del startServer");
                manager.StartServer();
                Debug.Log("dedicatebutton fue presionado despues del startServer");
            });
            quitButton.onClick.SetListener(() => { NetworkManagerFV.Quit(); });

            auth.loginAccount  = accountInput.text;
            auth.loginPassword = passwordInput.text;

            serverDropdown.interactable = !manager.isNetworkActive;
            serverDropdown.options      = manager.serverList.Select(
                sv => new Dropdown.OptionData(sv.name)
                ).ToList();
            manager.networkAddress = manager.serverList[serverDropdown.value].ip;
        }
        else
        {
            panel.SetActive(false);
        }
    }
Example #11
0
        public void ShowPopup(PopupType popupType)
        {
            //get a clone of the UIPopup, with the given PopupName, from the UIPopup Database
            m_popup = UIPopup.GetPopup(PopupName);

            //make sure that a popup clone was actually created
            if (m_popup == null)
            {
                return;
            }

            var icon    = m_popup.Data.Images[0];
            var title   = m_popup.Data.Labels[0].GetComponent <Text>(); //we know this has a Text component because we created it
            var message = m_popup.Data.Labels[1].GetComponent <Text>();

            switch (popupType)
            {
            case PopupType.Error:
                m_popup.Data.SetImagesSprites(ErrorSprite);                //set icon (we know we have one because we created this UIPopup with it)
                m_popup.Data.SetLabelsTexts(ErrorTitle, ErrorMessage);     //set the title and the message (we know they exist and their order because we created them)
                icon.color    = ErrorTextColor;                            //set the icon color (we use white icons, so we can set any tint color)
                title.color   = ErrorTextColor;                            //set title text color
                message.color = ErrorTextColor;                            //set message text color
                break;

            case PopupType.Info:
                m_popup.Data.SetImagesSprites(InfoSprite);               //set icon (we know we have one because we created this UIPopup with it)
                m_popup.Data.SetLabelsTexts(InfoTitle, InfoMessage);     //set the title and the message (we know they exist and their order because we created them)
                icon.color    = InfoTextColor;                           //set the icon color (we use white icons, so we can set any tint color)
                title.color   = InfoTextColor;                           //set title text color
                message.color = InfoTextColor;                           //set message text color
                break;

            case PopupType.Warning:
                m_popup.Data.SetImagesSprites(WarningSprite);                  //set icon (we know we have one because we created this UIPopup with it)
                m_popup.Data.SetLabelsTexts(WarningTitle, WarningMessage);     //set the title and the message (we know they exist and their order because we created them)
                icon.color    = WarningTextColor;                              //set the icon color (we use white icons, so we can set any tint color)
                title.color   = WarningTextColor;                              //set title text color
                message.color = WarningTextColor;                              //set message text color
                break;

            case PopupType.Whatever:
                m_popup.Data.SetImagesSprites(WhateverSprite);                   //set icon (we know we have one because we created this UIPopup with it)
                m_popup.Data.SetLabelsTexts(WhateverTitle, WhateverMessage);     //set the title and the message (we know they exist and their order because we created them)
                icon.color    = WhateverTextColor;                               //set the icon color (we use white icons, so we can set any tint color)
                title.color   = WhateverTextColor;                               //set title text color
                message.color = WhateverTextColor;                               //set message text color
                break;

            default: throw new ArgumentOutOfRangeException("popupType", popupType, null);
            }

            m_popup.Show(); //show the popup
        }
Example #12
0
    public void ShowWinPopup()
    {
        _popup = GameObject.Instantiate(gameWinPopup, _gameManager.masterCanvas.transform);
        Text text = _popup.transform.GetChild(1).GetChild(1).GetComponent <Text>();

        text.text = _gameManager.getCostTime().ToString("耗费时间:#0.0s");
        Button button = _popup.transform.GetChild(1).GetChild(2).GetComponent <Button>();

        button.onClick.AddListener(this.hidePopup);
        _popup.Show();
    }
 public override void ShowPopup()
 {
     if (popup != null)
     {
         popup.Show();
     }
     else
     {
         Debug.LogError($"Popup is null");
     }
 }
Example #14
0
    void Update()
    {
        // only show while offline
        // AND while in handshake since we don't want to show nothing while
        // trying to login and waiting for the server's response
        if (manager.state == NetworkState.Offline || manager.state == NetworkState.Handshake)
        {
            panel.SetActive(true);

            // status
            if (manager.IsConnecting())
            {
                statusText.text = "Connecting...";
            }
            else if (manager.state == NetworkState.Handshake)
            {
                statusText.text = "Handshake...";
            }
            else
            {
                statusText.text = "";
            }

            // buttons. interactable while network is not active
            // (using IsConnecting is slightly delayed and would allow multiple clicks)
            registerButton.interactable = !manager.isNetworkActive;
            registerButton.onClick.SetListener(() => { uiPopup.Show(registerMessage); });
            loginButton.interactable = !manager.isNetworkActive && manager.IsAllowedAccountName(accountInput.text);
            loginButton.onClick.SetListener(() => { manager.StartClient(); });
            hostButton.interactable = Application.platform != RuntimePlatform.WebGLPlayer && !manager.isNetworkActive && manager.IsAllowedAccountName(accountInput.text);
            hostButton.onClick.SetListener(() => { manager.StartHost(); });
            cancelButton.gameObject.SetActive(manager.IsConnecting());
            cancelButton.onClick.SetListener(() => { manager.StopClient(); });
            dedicatedButton.interactable = Application.platform != RuntimePlatform.WebGLPlayer && !manager.isNetworkActive;
            dedicatedButton.onClick.SetListener(() => { manager.StartServer(); });
            quitButton.onClick.SetListener(() => { NetworkManagerMMO.Quit(); });

            // inputs
            manager.loginAccount  = accountInput.text;
            manager.loginPassword = passwordInput.text;

            // copy servers to dropdown; copy selected one to networkmanager ip/port.
            serverDropdown.interactable = !manager.isNetworkActive;
            serverDropdown.options      = manager.serverList.Select(
                sv => new Dropdown.OptionData(sv.name)
                ).ToList();
            manager.networkAddress = manager.serverList[serverDropdown.value].ip;
        }
        else
        {
            panel.SetActive(false);
        }
    }
Example #15
0
    // ================================== COMMON UI ======================================

    // -----------------------------------------------------------------------------------
    // UCE_PopupShow
    // -----------------------------------------------------------------------------------
    public void UCE_PopupShow(string message)
    {
        if (message == "")
        {
            return;
        }
        if (UCE_popup == null)
        {
            UCE_popup = FindObjectOfType <UIPopup>();
        }
        UCE_popup.Show(message);
    }
Example #16
0
    void Update()
    {
        isLoggedin    = DataService.isLoggedin;
        tryingToLogin = DataService.tryingToLogin;

        if (DataService.isLoggedin == false &&
            DataService.tryingToLogin == false &&
            loginPopup.IsHidden)
        {
            // Pop Login Window
            loginPopup.Show();
        }
    }
Example #17
0
        public override void ShowPopup()
        {
            UIPopup popup = UIPopup.GetPopup(_name);

            if (popup != null)
            {
                popup.Show();
            }
            else
            {
                Debug.LogError("Popup is null");
            }
        }
Example #18
0
    public void ShowPopup()
    {
        if (popup == null)
        {
            return;
        }

        if (!popup.IsShowing)
        {
            spawnPopup = true;
            popup.transform.position = Camera.main.WorldToScreenPoint(gameObject.transform.position);
            popup.Show();
        }
    }
Example #19
0
 public void ShowPopup(string title, string message)
 {
     if (!canShowPopup)
     {
         return;
     }
     PauseMenuCanBeOpened = false;
     optionsButton.SetActive(false);
     upgradeUI.HideToggle();
     fader.FadeIn(delegate {
         UIPopup uiPopup = Prefabs.Get <UIPopup>();
         uiPopup.Init(popupContainer, this);
         uiPopup.Show(title, message);
     });
 }
        private void Start()
        {
            SetDateText(m_selectedDate); // set present day

            m_dateButton.OnClick.OnTrigger.Event.AddListener(() =>
            {
                UIPopup calendarPopup = UIPopup.GetPopup("CalendarPopup");
                calendarPopup.Show();
                calendarPopup.Data.Buttons[0].OnClick.OnTrigger.Event.AddListener(() =>
                {
                    m_selectedDate = calendarPopup.GetComponent <CalendarController>().GetSelectedDate();
                    SetDateText(m_selectedDate);
                });
            });
        }
    private void ShowPopup(UnlockResult newUnlock)
    {
        UIPopup popup = UIPopup.GetPopup(Popups.UNLOCK_POPUP);

        if (popup == null)
        {
            return;
        }

        PopupUnlock popupUnlock = popup.GetComponent <PopupUnlock>();

        popupUnlock.Setup(newUnlock);

        popup.Show();
    }
Example #22
0
    void Update()
    {
        // only show while offline or trying to connect
        if (!manager.IsClientConnected())
        {
            panel.SetActive(true);

            // status
            statusText.text = manager.IsConnecting() ? "Connecting..." : "";

            // buttons. interactable while network is not active
            // (using IsConnecting is slightly delayed and would allow multiple clicks)
            registerButton.onClick.SetListener(() => { uiPopup.Show(registerMessage); });
            loginButton.interactable = !manager.isNetworkActive && manager.IsAllowedAccountName(accountInput.text);
            loginButton.onClick.SetListener(() => { manager.StartClient(); });
            hostButton.interactable = !manager.isNetworkActive && manager.IsAllowedAccountName(accountInput.text);
            hostButton.onClick.SetListener(() => { manager.StartHost(); });
            cancelButton.gameObject.SetActive(manager.IsConnecting());
            cancelButton.onClick.SetListener(() => { manager.StopClient(); });
            dedicatedButton.interactable = !manager.isNetworkActive;
            dedicatedButton.onClick.SetListener(() => { manager.StartServer(); });
            quitButton.onClick.SetListener(() => { NetworkManagerMMO.Quit(); });

            // inputs
            manager.loginAccount  = accountInput.text;
            manager.loginPassword = passwordInput.text;

            // copy servers to dropdown; copy selected one to networkmanager ip/port.
            serverDropdown.interactable = !manager.isNetworkActive;
            serverDropdown.options      = manager.serverList.Select(
                sv => new Dropdown.OptionData(sv.name)
                ).ToList();
            manager.networkAddress = manager.serverList[serverDropdown.value].ip;

            // addon system hooks
            Utils.InvokeMany(typeof(UILogin), this, "Update_");
        }
        else
        {
            panel.SetActive(false);
        }
    }
Example #23
0
        public void Show()
        {
            popup = UIPopup.GetPopup(prefabPopup.name);

            if (popup == null)
            {
                return;
            }

            popup.GetComponent <Popup>().SetImage(imageButton);

            popup.HideOnBackButton     = false;
            popup.HideOnClickAnywhere  = true;
            popup.HideOnClickOverlay   = true;
            popup.HideOnClickContainer = true;

            popup.AutoHideAfterShow = false;

            popup.Show();
        }
Example #24
0
        public void ShowPopup(UIPopup popup, bool show)
        {
            if (show && _waitUntilAllControlsHidden)
            {
                StartCoroutine(ShowPopupAfterAllControlsHide(popup));
                return;
            }

            foreach (var button in popup.Data.Buttons)
            {
                button.Interactable = show;
            }

            if (show)
            {
                popup.Show();
                _currOpenPopup = popup;
            }
            else
            {
                popup.Hide();
            }
        }
Example #25
0
        public void ShowPopup()
        {
            //get a clone of the UIPopup, with the given PopupName, from the UIPopup Database
            m_popup = UIPopup.GetPopup(PopupName);

            //make sure that a popup clone was actually created
            if (m_popup == null)
            {
                return;
            }

            //we assume (because we know) this UIPopup has a Title and a Message text objects referenced, thus we set their values
            m_popup.Data.SetLabelsTexts(Title, Message);

            //get the values from the label input fields
            LabelButtonOne = LabelButtonOneInput.text;
            LabelButtonTwo = LabelButtonTwoInput.text;

            //set the button labels
            m_popup.Data.SetButtonsLabels(LabelButtonOne, LabelButtonTwo);

            //set the buttons callbacks as methods
            m_popup.Data.SetButtonsCallbacks(ClickButtonOne, ClickButtonTwo);

            //OR set the buttons callbacks as lambda expressions
            //m_popup.Data.SetButtonsCallbacks(() => { ClickButtonOne(); }, () => { ClickButtonTwo(); });

            //if the developer did not enable at least one button to hide it, make the UIPopup hide when its Overlay is clicked
            if (!HideOnButtonOne && !HideOnButtonTwo)
            {
                m_popup.HideOnClickOverlay = true;
                DDebug.Log("Popup '" + PopupName + "' is set to close when clicking its Overlay because you did not enable any hide option");
            }

            m_popup.Show(); //show the popup
        }
Example #26
0
 private void Editor_Popup()
 {
     _currentPopup = UIPopup.GetPopup(POPUP_NAME);
     _currentPopup.Show();
 }
Example #27
0
    public static void ShowPopup(string target)
    {
        UIPopup popup = UIPopup.GetPopup(target);

        popup.Show();
    }
 public void ShowPopup()
 {
     popup.Show();
     showButton.GetComponent <Image>().color = transparentColor;
 }
Example #29
0
 private void SetDescriptionImage(Sprite description)
 {
     _currentPopup.Data.SetImagesSprites(description);
     _currentPopup.Show();
 }
 void onGameIsOver(GameIsOverSignal arg)
 {
     _popup.Show();
 }