private void OnLoginEmailFailure(PlayFabError error) { Debug.Log(error.GenerateErrorReport()); Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert(error.ErrorMessage)); }
public void AddFriend() { AddFriendRequest request = new AddFriendRequest(); request.FriendUsername = friendrequestText.text; PlayFabClientAPI.AddFriend(request, result => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert("Added friend: " + friendrequestText.text)); GameObject[] curFriends = GameObject.FindGameObjectsWithTag("Friend"); foreach (GameObject friend in curFriends) { GameObject.Destroy(friend); } GetFriends(); }, error => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert(error.ErrorMessage)); Debug.Log(error.ErrorMessage); }); }
public void PurchaseWeaponPrimary() { PurchaseItemRequest request = new PurchaseItemRequest(); request.CatalogVersion = "Weapons"; request.VirtualCurrency = "GO"; if (PrimaryWeaponImages[0].activeSelf) { request.ItemId = "AKM"; request.Price = 2000; PlayFabClientAPI.PurchaseItem(request, result => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert("You have purchased the AKM!")); UpdateCurrentGold(); PlayerOwnsAKM = true; }, error => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert(error.ErrorMessage)); }); } else if (PrimaryWeaponImages[1].activeSelf) { request.ItemId = "M4"; request.Price = 2000; PlayFabClientAPI.PurchaseItem(request, result => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert("You have purchased the M4!")); UpdateCurrentGold(); PlayerOwnsM4 = true; }, error => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert(error.ErrorMessage)); }); } else if (PrimaryWeaponImages[2].activeSelf) { request.ItemId = "L96"; request.Price = 4500; PlayFabClientAPI.PurchaseItem(request, result => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert("You have purchased the L96 Sniper!")); UpdateCurrentGold(); PlayerOwnsL96 = true; }, error => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert(error.ErrorMessage)); }); } }
private void OnLoginEmailSuccess(PlayFab.ClientModels.LoginResult result) { Debug.Log("Congratulations, API called successfully. Login method: Email"); // GetPlayerCombinedInfo(); Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert(userName.text + ", you have logged in!")); SceneManager.LoadScene(SceneToLoad); }
public void Login() { LoginWithPlayFabRequest request = new LoginWithPlayFabRequest(); request.Username = UserName.text; request.Password = UserName.text; PlayFabClientAPI.LoginWithPlayFab(request, result => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert(UserName.text + " You have logged in")); SceneManager.LoadScene(LevelToLoad); }, error => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert(error.ErrorMessage)); }); }
public void PurchaseWeaponSecondary() { PurchaseItemRequest request = new PurchaseItemRequest(); request.CatalogVersion = "Weapons"; request.VirtualCurrency = "GO"; if (SecondaryWeaponImages[0].activeSelf) { request.ItemId = "Glock"; request.Price = 500; PlayFabClientAPI.PurchaseItem(request, result => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert("You have purchased the Glock!")); UpdateCurrentGold(); PlayerOwnsGlock = true; }, error => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert(error.ErrorMessage)); }); } if (SecondaryWeaponImages[1].activeSelf) { request.ItemId = "Shotgun"; request.Price = 3000; PlayFabClientAPI.PurchaseItem(request, result => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert("You have purchased the Shotgun!")); UpdateCurrentGold(); PlayerOwnsShotgun = true; }, error => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert(error.ErrorMessage)); }); } }
public void CreateAccount() { if (Password.text == ConfPassword.text) { RegisterPlayFabUserRequest request = new RegisterPlayFabUserRequest(); request.Username = Username.text; request.Password = ConfPassword.text; request.Email = Email.text; request.DisplayName = Username.text; PlayFabClientAPI.RegisterPlayFabUser(request, result => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert("Your Account " + result.Username + " Has been created!")); }, error => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert(error.ErrorMessage)); }); } }
void CheckUserInventory() { GetUserInventoryRequest requestInventory = new GetUserInventoryRequest(); PlayFabClientAPI.GetUserInventory(requestInventory, result => { foreach (ItemInstance item in result.Inventory) { if (item.ItemId == "AKM") { PlayerOwnsAKM = true; } if (item.ItemId == "M4") { PlayerOwnsM4 = true; } if (item.ItemId == "L96") { PlayerOwnsL96 = true; } if (item.ItemId == "Glock") { PlayerOwnsGlock = true; } if (item.ItemId == "Shotgun") { PlayerOwnsShotgun = true; } } }, error => { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert(error.ErrorMessage)); }); }
private void OnRegisterPlayFabSuccess(RegisterPlayFabUserResult result) { Alerts a = new Alerts(); StartCoroutine(a.CreateNewAlert(result.Username + "has been created!")); }