Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using PlayFab;
- using PlayFab.ClientModels;
- using System.Net;
- public class EntryInterface : MonoBehaviour {
- public InputField UsernameInput;
- public InputField PasswordInput;
- public void LoginRequest()
- {
- string username = UsernameInput.text;
- string password = PasswordInput.text;
- LoginWithPlayFabRequest loginRequest = new LoginWithPlayFabRequest();
- loginRequest.Username = username;
- loginRequest.Password = password;
- PlayFabClientAPI.LoginWithPlayFab(loginRequest, (result) =>
- {
- LocalPlayer.Instance.PlayFabID = result.PlayFabId;
- MatchmakeRequest matchmakeRequest = new MatchmakeRequest();
- matchmakeRequest.BuildVersion = "Awesome";
- matchmakeRequest.GameMode = "Default";
- matchmakeRequest.Region = Region.USCentral;
- matchmakeRequest.StartNewIfNoneFound = true;
- PlayFabClientAPI.Matchmake(matchmakeRequest, (x) => {
- NetworkClient.Instance.ConnectInBackground(IPAddress.Parse(x.ServerHostname), (int)x.ServerPort, NetworkClient.Instance.IPVersion);
- }, (error) => {
- Debug.Log(error.ErrorMessage);
- NetworkClient.Instance.ConnectInBackground(NetworkClient.Instance.Address, NetworkClient.Instance.Port, NetworkClient.Instance.IPVersion);
- });
- Debug.Log("Successfully logged '" + result.PlayFabId + "' into PlayFab");
- }, (error) =>
- {
- Debug.Log(error.ErrorMessage);
- });
- }
- public void OfflineMode()
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement