Пример #1
0
    //=============================================================================

    IEnumerator RenamePlayer()
    {
        IRequest req = PlayerWS.ChangeNickname(NewName);

        yield return(StartCoroutine(req));

        if (RequestOK(req, "Renamed"))
        {
            string prefix = "Player";
            PlayerPrefs.SetString(prefix + "Nick", PlayerWS.PlayerNick);
            PlayerPrefs.Save();
        }
        else
        {
            Debug.Log("Renaming failed with error: " + req.Status);

            string error = string.Empty;
            switch (req.Status)
            {
            case RequestStatus.FAIL_CONFLICT:
                error = TextManager.GetText("POPUP_NAME_UNAVAILABLE");
                break;

            default:
                error = TextManager.GetText("POPUP_NAME_ERROR");
                break;
            }

            if (null != RegistrationFailEvent)
            {
                RegistrationFailEvent(error);
            }
        }
    }