예제 #1
0
    void GetPhotonAuthenticationToken()
    {
        GetPhotonAuthenticationTokenRequest req = new GetPhotonAuthenticationTokenRequest();

        req.PhotonApplicationId = "244e35d0-57ff-4e29-b492-62a470851a50";//"2ebff324-aec4-4b3f-8621-4ead47c7758c";

        PlayFabClientAPI.GetPhotonAuthenticationToken(req, OnPhotonAuthenticationSuccess, OnPlayfabError);
    }
예제 #2
0
    void OnLoginSuccess(LoginResult result)
    {
        PlayFabId = result.PlayFabId;
        GetPhotonAuthenticationTokenRequest request = new GetPhotonAuthenticationTokenRequest();

        request.PhotonApplicationId = PhotonApplicationId;
//		// get an authentication ticket to pass on to Photon
        PlayFabClientAPI.GetPhotonAuthenticationToken(request, OnPhotonAuthenticationSuccess, OnPlayFabError);
    }
예제 #3
0
        public override void OnEnter()
        {
            var request = new GetPhotonAuthenticationTokenRequest()
            {
                PhotonApplicationId = photonApplicationId.Value
            };

            PlayFabClientAPI.GetPhotonAuthenticationToken(request, OnSuccess, OnFailure);
        }
예제 #4
0
    void OnLoginSuccess(LoginResult result)
    {
        playfabId = result.PlayFabId;
        var request = new GetPhotonAuthenticationTokenRequest
        {
            PhotonApplicationId = PhotonNetwork.PhotonServerSettings.AppID.Trim(),
        };

        PlayFabClientAPI.GetPhotonAuthenticationToken(request, OnAuthTokenResult, OnFail);
    }
예제 #5
0
    // callback on successful LoginToPlayFab request
    void OnLoginSuccess(LoginResult result)
    {
        Debug.Log(result.PlayFabId);
        StartCoroutine(GetUserStats());
        this.playfabId = result.PlayFabId;
        GetPhotonAuthenticationTokenRequest request = new GetPhotonAuthenticationTokenRequest();

        request.PhotonApplicationId = photonComponent.AppId.Trim();
        // get an authentication ticket to pass on to Photon
        PlayFabClientAPI.GetPhotonAuthenticationToken(request, OnPhotonAuthenticationSuccess, OnPlayFabError);
    }
예제 #6
0
    private void ConnectToPhoton()
    {
        Logger.Verbose("MainPageScript.ConnectToPhoton");
        // Retrieve the Photon Auth Token
        JUMPConnectionStatus = JUMPConnectionStatus.RetrievingAuthToken;

        GetPhotonAuthenticationTokenRequest request = new GetPhotonAuthenticationTokenRequest();

        request.PhotonApplicationId = PhotonAppID;

        // get an authentication ticket to pass on to Photon
        PlayFabClientAPI.GetPhotonAuthenticationToken(request, OnPhotonAuthenticationSuccess, OnPlayFabError);
    }
예제 #7
0
    private void OnPlayFabLoginSuccess(LoginResult result)
    {
        Debug.Log("PlayFab Login Success");
        playfabUserID = result.PlayFabId;               // record our playfab user ID

        StartCoroutine(CoGetPlayerXP());                // request the XP for this user

        GetPhotonAuthenticationTokenRequest request = new GetPhotonAuthenticationTokenRequest();

        request.PhotonApplicationId = PHOTON_APP_ID;
        // get an authentication ticket to pass on to Photon
        PlayFabClientAPI.GetPhotonAuthenticationToken(request, OnPhotonAuthenticationSuccess, OnPlayFabError);
    }
예제 #8
0
    private void AuthenticateWithPhoton(GetPhotonAuthenticationTokenRequest obj)
    {
        LogMessage("Photon token acquired: " + obj.PhotonCustomAuthenticationToken + " Authentication comeplete.");

        var customAuth = new AuthenticationValues {
            AuthType = CustomAuthenticationType.Custom
        };

        customAuth.AddAuthParameter("username", _playFabPlayerIdCache);

        PhotonNetwork.AuthValues = customAuth;

        PhotonNetwork.ConnectUsingSettings();
    }
예제 #9
0
        public void OnPlayFabSuccessLogin()
        {
            Client.PlayerName = DisplayName;

            RefreshNetInfo("正在对接 Photon...");

            GetPhotonAuthenticationTokenRequest request = new GetPhotonAuthenticationTokenRequest();

            request.PhotonApplicationId = AppId;
            PlayFabClientAPI.GetPhotonAuthenticationToken(request, res => {
                if (WaitPhotonStateDisposable != null)
                {
                    WaitPhotonStateDisposable.Dispose();
                }

                ConnectToMasterServer(PlayFabId, res.PhotonCustomAuthenticationToken);
            }, err => {
                Client.State = ClientState.Uninitialized;
                RefreshNetInfo("错误:无法从 PlayFab 获取 Photon Token");
            });
        }
예제 #10
0
    /// <summary>
    /// Callback called when user login completes.
    /// </summary>
    /// <param name="result">Result of user login</param>
    void OnLoginCompleted(LoginResult result)
    {
        playerID = result.PlayFabId;

        PushNotificationsManager.instance.Register();

        this.LoadTitleData();

        GetPhotonAuthenticationTokenRequest tokenrequest = new GetPhotonAuthenticationTokenRequest();

        tokenrequest.PhotonApplicationId = AppId;

        PlayFabClientAPI.GetPhotonAuthenticationToken(tokenrequest, OnPhotonAuthenticationSuccess, OnPlayFabError);


        if (result.NewlyCreated)
        {
            Dictionary <string, string> playerData = new Dictionary <string, string>();
            playerData.Add(GameConstants.accountLevelKey, "0");
            playerData.Add(GameConstants.accountExpKey, "0");
            playerData.Add(GameConstants.facebookPictureKey, playerPictureURL);

            UpdateUserDataRequest request = new UpdateUserDataRequest();
            request.Data       = playerData;
            request.Permission = UserDataPermission.Public;

            PlayFabClientAPI.UpdateUserData(request, OnAddDataSuccess, OnAddDataError);
        }
        else
        {
            Dictionary <string, string> playerData = new Dictionary <string, string>();
            playerData.Add(GameConstants.facebookPictureKey, playerPictureURL);

            UpdateUserDataRequest request = new UpdateUserDataRequest();
            request.Data       = playerData;
            request.Permission = UserDataPermission.Public;

            PlayFabClientAPI.UpdateUserData(request, OnAddDataSuccess, OnAddDataError);
        }
    }