Beispiel #1
0
    public UpdateMFAccountAndFetchPPI UpdateUser(string inPasswordHash, string inNickName, string inEmail, bool inIWantNews, GeoRegion inRegion)
    {
        UpdateMFAccountAndFetchPPI action = new UpdateMFAccountAndFetchPPI(m_AuthenticatedUserID,
                                                                           inNickName,
                                                                           inEmail,
                                                                           inIWantNews,
                                                                           NetUtils.GetRegionString(inRegion));

        GameCloudManager.AddAction(action);

        return(action);
    }
    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);
    }