Example #1
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    //-----------------------------------------------------------------------------------------------------------------
    void Play()
    {
        if (LobbyClient.IsConnected)
        {
            string gameType  = (m_GameType == E_MPGameType.ZoneControl) ? "zc" : "dm";
            bool   voiceChat = GetPreferVoiceChat();

            m_LastJoinRequestId  = m_NextJoinRequestId;
            m_NextJoinRequestId += 1;

            bool result;

            if (m_OtherPlayers == null)
            {
                result = LobbyClient.FindServerForOnePlayer(m_LastJoinRequestId, gameType, voiceChat);
            }
            else
            {
                result = LobbyClient.FindServerForGang(m_LastJoinRequestId, gameType, voiceChat, m_OtherPlayers);
            }

            if (!result)
            {
                if (LobbyClient.GameVersionNoLongerSupported)
                {
                    Popup.Show(TextDatabase.instance[0109061], TextDatabase.instance[0109056], TextDatabase.instance[02040007], OnMessageBoxEvent);
                }
                else
                {
                    Popup.Show(TextDatabase.instance[0109061], TextDatabase.instance[0109057], TextDatabase.instance[02040007], OnMessageBoxEvent);
                }

                return;
            }

            m_IsLookingForServer = true;

            GuiScreenLobby lobby = Owner as GuiScreenLobby;
            if (lobby != null)
            {
                lobby.RegisterRequest(m_LastJoinRequestId);
            }

            Popup.Show(TextDatabase.instance[0109061], TextDatabase.instance[0109058], TextDatabase.instance[02040009], OnMessageBoxEvent);
        }
        else
        {
            LobbyClient.ToLobbyConnectionResult += OnLobbyConnectionResult;

            m_IsConnectingToLobby = true;
            LobbyClient.ConnectToLobby(CloudUser.instance.region);

            Popup.Show(TextDatabase.instance[0109061], TextDatabase.instance[0109059], TextDatabase.instance[02040009], OnMessageBoxEvent);
        }
    }
Example #2
0
    static bool ShowMainMenu()
    {
        if (OpenMenu(E_MenuState.Menu) == false)
        {
            return(false);
        }

        LobbyClient.ConnectToLobby(CloudUser.instance.region);

        if (!ChartBoost.hasCachedMoreApps())
        {
            ChartBoost.cacheMoreApps();
        }

        return(true);
    }
    IEnumerator UpdateProfile_Coroutine()
    {
        // show message box with some info
        GuiPopupMessageBox msgbox =
            Owner.ShowPopup("MessageBox", TextDatabase.instance[0107000], TextDatabase.instance[0107022]) as GuiPopupMessageBox;

        msgbox.SetButtonVisible(false);

        // update profile
        UpdateMFAccountAndFetchPPI action = CloudUser.instance.UpdateUser(m_Password1Hash,
                                                                          GuiBaseUtils.FixNickname(m_Nickname, CloudUser.instance.userName_TODO),
                                                                          null,
                                                                          m_ReceiveNews,
                                                                          m_Region);

        while (action.isDone == false)
        {
            yield return(new WaitForSeconds(0.2f));
        }

        if (action.isSucceeded == true)
        {
            // update cloud user with actual informations
            string username   = "";
            string nickname   = "";
            string password   = "";
            int    pwdLength  = 0;
            bool   rememberMe = true;
            bool   autoLogin  = true;
            CloudUser.instance.GetLoginData(ref nickname, ref username, ref password, ref pwdLength, ref rememberMe, ref autoLogin);
            CloudUser.instance.SetLoginData(CloudUser.instance.primaryKey,
                                            m_Nickname,
                                            username,
                                            m_Password1Hash,
                                            m_PasswordLength,
                                            rememberMe,
                                            autoLogin);
            CloudUser.instance.receiveNews = m_ReceiveNews;
            CloudUser.instance.region      = m_Region;

            PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPPI();
            if (ppi != null)
            {
                ppi.Name = m_Nickname;
                PPIManager.Instance.NotifyLocalPPIChanged();
            }

            // connect to correct lobby
            LobbyClient.ConnectToLobby(m_Region);

            // inform user that we are done
            msgbox.SetText(TextDatabase.instance[0107020]);
            msgbox.SetHandler((popup, result) => { Owner.Back(); });
        }
        else
        {
            // inform user that there were a problem with updating
            msgbox.SetText(TextDatabase.instance[0107021]);
        }

        // let user press 'OK'
        msgbox.SetButtonText(TextDatabase.instance[0107024]);
        msgbox.SetButtonVisible(true);
    }