コード例 #1
0
            public void CompleteGetXToken(int hresult, XUserGetTokenAndSignatureUtf16Data tokenData)
            {
                PlayFabMultiplayerManager._LogInfo("PlayFabChatXboxLivePolicyProvider:CompleteGetXToken(), hr: " + hresult);

                if (hresult >= 0)
                {
                    Get().Succeeded(XBLSDK.PartyXblCompleteGetTokenAndSignatureRequest(
                                        Get()._xblPartyHandle,
                                        correlationId,
                                        true,
                                        tokenData.Token,
                                        tokenData.Signature
                                        ));
                }
                else if (hresult == _E_GAMEUSER_RESOLVE_USER_ISSUE_REQUIRED)
                {
                    // We need to resolve
#if (MICROSOFT_GAME_CORE || UNITY_GAMECORE)
                    XGamingRuntime.SDK.XUserResolveIssueWithUiUtf16Async(
                        Get()._xblLocalUserHandle,
                        url,
                        _ResolveUserIssueWithUICompleted
                        );
#endif
                }
                else
                {
                    PlayFabMultiplayerManager._LogError(_ErrorMessageCouldNotGetXboxLiveToken);
                }
            }
コード例 #2
0
        public void SignIn()
        {
            PlayFabMultiplayerManager._LogInfo("PlayFabChatXboxLivePolicyProvider:SignIn()");

            try
            {
                XGamingRuntime.SDK.XUserAddAsync(XUserAddOptions.AddDefaultUserSilently, SignInSilentlyComplete);
            }
            catch (NullReferenceException)
            {
                PlayFabMultiplayerManager._LogError(_ErrorMessageGamingRuntimeNotInitialized);
            }
            catch (Exception ex)
            {
                PlayFabMultiplayerManager._LogError(ex.Message);
            }
        }
コード例 #3
0
        private void SignInSilentlyComplete(int hresult, XUserHandle userHandle)
        {
            if (HrSucceeded(hresult))
            {
                _xblLocalUserHandle = userHandle;
            }
            else
            {
                PlayFabMultiplayerManager._LogError(_ErrorMessageXboxLiveSignInFailed);
            }

            ulong xuid;
            int   hr = 0;

#if (MICROSOFT_GAME_CORE || UNITY_GAMECORE)
            hr = XGamingRuntime.SDK.XUserGetId(_xblLocalUserHandle, out xuid);
#endif

            PlayFabMultiplayerManager._LogInfo("PlayFabChatXboxLivePolicyProvider:SignInSilentlyComplete(), XUID: " + xuid);

            if (HrSucceeded(hresult))
            {
                if (_xblLocalChatUserHandle == null)
                {
                    Succeeded(XBLSDK.PartyXblCreateLocalChatUser(
                                  _xblPartyHandle,
                                  xuid,
                                  null,
                                  out _xblLocalChatUserHandle
                                  ));
                }

                Succeeded(XBLSDK.PartyXblLoginToPlayFab(
                              _xblLocalChatUserHandle,
                              null
                              ));
            }
            else
            {
                PlayFabMultiplayerManager._LogError(_ErrorMessageCouldNotGetXuid);
            }
        }
コード例 #4
0
        public void SendPlatformSpecificUserId(List <PlayFabPlayer> targetPlayers)
        {
            PlayFabMultiplayerManager._LogInfo("PlayFabChatXboxLivePolicyProvider:SendPlatformSpecificUserId()");

            // Broadcast XUID to other endpoints in the network.
            ulong xuid;

#if (MICROSOFT_GAME_CORE || UNITY_GAMECORE)
            if (HrSucceeded(XGamingRuntime.SDK.XUserGetId(_xblLocalUserHandle, out xuid)))
#endif
            {
                string xuidMessageString = _XUID_EXCHANGE_REQUEST_MESSAGE_PREFIX + ":" + xuid;
                byte[] xuidMessageBytes  = Encoding.ASCII.GetBytes(xuidMessageString);
                _multiplayerManager._SendDataMessage(xuidMessageBytes, targetPlayers, DeliveryOption.Guaranteed);
            }
            else
            {
                PlayFabMultiplayerManager._LogError(_ErrorMessageCouldNotGetXuid);
            }
        }