public void SetDisplayName() { Action <string> processResponse = response => { if (response == null) { return; } PF_Authentication.UpdateDisplayName(response, result => { displayName.text = result.DisplayName; PF_PlayerData.accountInfo.TitleInfo.DisplayName = result.DisplayName; }); }; if (FB.IsLoggedIn) { UnityAction <string> afterGetFbName = fbName => { DialogCanvasController.RequestTextInputPrompt(GlobalStrings.DISPLAY_NAME_PROMPT, GlobalStrings.DISPLAY_NAME_MSG, processResponse, fbName); }; FacebookHelperClass.GetFBUserName(afterGetFbName); } else { DialogCanvasController.RequestTextInputPrompt(GlobalStrings.DISPLAY_NAME_PROMPT, GlobalStrings.DISPLAY_NAME_MSG, processResponse); } }
public void Init(FriendInfo friend) { _didCustomTagsChange = false; ClearAllTagUI(); DisplayName.text = string.IsNullOrEmpty(friend.TitleDisplayName) ? friend.Username : friend.TitleDisplayName; UserName.text = string.IsNullOrEmpty(friend.Username) ? "________" : friend.Username; PlayFabID.text = friend.FriendPlayFabId; Origin.text = friend.FacebookInfo != null ? "Facebook" : "PlayFab"; RemoveFriendBtn.interactable = friend.FacebookInfo == null; activeFriend = friend; if (friend.Tags != null) { for (var z = 0; z < friend.Tags.Count; z++) { AddTagItemUI(tag, z); } } if (friend.FacebookInfo != null && !string.IsNullOrEmpty(friend.FacebookInfo.FacebookId)) { UnityAction <Texture2D> afterGetPhoto = tx => { ProfilePhoto.overrideSprite = Sprite.Create(tx, new Rect(0, 0, 128, 128), new Vector2()); }; StartCoroutine(FacebookHelperClass.GetFriendProfilePhoto(friend.FacebookInfo.FacebookId, FetchWebAsset, afterGetPhoto)); } else { ProfilePhoto.overrideSprite = null; } }
public void SetDisplayName() { Action <string> processResponse = (string response) => { if (response != null) { PF_Authentication.UpdateDisplayName(response, (UpdateUserTitleDisplayNameResult result) => { this.displayName.text = result.DisplayName; PF_PlayerData.accountInfo.TitleInfo.DisplayName = result.DisplayName; }); } }; if (PF_PlayerData.accountInfo.FacebookInfo != null) { UnityAction <string> afterGetFBName = (string name) => { DialogCanvasController.RequestTextInputPrompt(GlobalStrings.DISPLAY_NAME_PROMPT, GlobalStrings.DISPLAY_NAME_MSG, processResponse, name); }; FacebookHelperClass.GetFBUserName(afterGetFBName); } else { DialogCanvasController.RequestTextInputPrompt(GlobalStrings.DISPLAY_NAME_PROMPT, GlobalStrings.DISPLAY_NAME_MSG, processResponse); } }
public void ToggleFacebookLink() { if (PF_PlayerData.accountInfo.FacebookInfo != null) { Action <bool> afterCheck = (bool response) => { if (response == true) { //unlink UnityAction afterUnlink = () => { Text txt = this.linkToFaceBook.GetComponentInChildren <Text>(); txt.color = Color.red; txt.text = GlobalStrings.LINK_FB_BTN_MSG; this.facebookPicture.overrideSprite = null; Debug.Log("NEED ACCOUNT REFRESH???"); PF_PlayerData.accountInfo.FacebookInfo = null; this.changedLoginState = true; }; PF_PlayerData.UnlinkFBAccount(afterUnlink); } }; DialogCanvasController.RequestConfirmationPrompt(GlobalStrings.CONFIRM_UNLINK_PROMPT, GlobalStrings.CONFIRM_UNLINK_MSG, afterCheck); } else { // link UnityAction afterLink = () => { Text btnText = this.linkToFaceBook.GetComponentInChildren <Text>(); btnText.text = GlobalStrings.UNLINK_FB_BTN_MSG; btnText.color = Color.green; Debug.Log("NEED ACCOUNT REFRESH???"); this.changedLoginState = true; PF_PlayerData.accountInfo.FacebookInfo = new UserFacebookInfo(); UnityAction <Texture2D> afterGetPhoto = (Texture2D tx) => { facebookPicture.overrideSprite = Sprite.Create(tx, new Rect(0, 0, 128, 128), new Vector2()); }; StartCoroutine(FacebookHelperClass.GetPlayerProfilePhoto(FetchWebAsset, afterGetPhoto)); }; PF_PlayerData.LinkFBAccount(afterLink); } }
private void UpdateFacebookStatusButton() { Debug.Log("UpdateFacebookStatusButton: " + FB.IsLoggedIn); var txt = linkToFaceBook.GetComponentInChildren <Text>(); txt.text = FB.IsLoggedIn ? GlobalStrings.UNLINK_FB_BTN_MSG : GlobalStrings.LINK_FB_BTN_MSG; facebookPicture.overrideSprite = null; if (FB.IsLoggedIn) { UnityAction <Texture2D> afterGetPhoto = tx => { facebookPicture.overrideSprite = Sprite.Create(tx, new Rect(0, 0, 128, 128), Vector2.zero); }; StartCoroutine(FacebookHelperClass.GetPlayerProfilePhoto(FetchWebAsset, afterGetPhoto)); } }
public void Init(FriendInfo friend) { // reset from previous this.didCustomTagsChange = false; ClearAllTagUI(); //Update new info this.DisplayName.text = friend.TitleDisplayName; this.UserName.text = string.IsNullOrEmpty(friend.Username) ? "________" : friend.Username; this.PlayFabID.text = friend.FriendPlayFabId; this.Origin.text = friend.FacebookInfo != null ? "Facebook" : "PlayFab"; if (friend.FacebookInfo != null) { this.RemoveFriendBtn.interactable = false; } else { this.RemoveFriendBtn.interactable = true; } this.activeFriend = friend; if (friend.Tags != null) { for (int z = 0; z < friend.Tags.Count; z++) { AddTagItemUI(tag, z); } } //friend.FacebookInfo != null // get profile pic if (friend.FacebookInfo != null && !string.IsNullOrEmpty(friend.FacebookInfo.FacebookId)) { UnityAction <Texture2D> afterGetPhoto = (Texture2D tx) => { ProfilePhoto.overrideSprite = Sprite.Create(tx, new Rect(0, 0, 128, 128), new Vector2()); }; StartCoroutine(FacebookHelperClass.GetFriendProfilePhoto(friend.FacebookInfo.FacebookId, FetchWebAsset, afterGetPhoto)); } else { ProfilePhoto.overrideSprite = null; } }
public void Init() { if (PF_PlayerData.accountInfo != null) { this.changedLoginState = false; displayName.text = PF_PlayerData.accountInfo.TitleInfo.DisplayName; if (string.IsNullOrEmpty(PF_PlayerData.accountInfo.Username) || string.IsNullOrEmpty(PF_PlayerData.accountInfo.PrivateInfo.Email)) { accountStatus.color = Color.red; accountStatus.text = GlobalStrings.ACT_STATUS_UNREG_MSG; this.registerAccount.gameObject.SetActive(true); this.resetPassword.gameObject.SetActive(false); } else { accountStatus.color = Color.green; accountStatus.text = GlobalStrings.ACT_STATUS_REG_MSG; this.registerAccount.gameObject.SetActive(false); this.resetPassword.gameObject.SetActive(true); } if (PF_PlayerData.showAccountOptionsOnLogin == true) { this.isShownOnLogin = true; this.showOnLogin.GetComponent <Image>().overrideSprite = this.checkedBox; } else { this.isShownOnLogin = false; this.showOnLogin.GetComponent <Image>().overrideSprite = this.uncheckedBox; } if (PF_PlayerData.accountInfo.FacebookInfo != null) { Text btnText = this.linkToFaceBook.GetComponentInChildren <Text>(); btnText.text = GlobalStrings.UNLINK_FB_BTN_MSG; //btnText.color = Color.green; UnityAction <Texture2D> afterGetPhoto = (Texture2D tx) => { facebookPicture.overrideSprite = Sprite.Create(tx, new Rect(0, 0, 128, 128), new Vector2()); }; StartCoroutine(FacebookHelperClass.GetPlayerProfilePhoto(FetchWebAsset, afterGetPhoto)); } else { Text btnText = this.linkToFaceBook.GetComponentInChildren <Text>(); btnText.text = GlobalStrings.LINK_FB_BTN_MSG; //btnText.color = Color.red; facebookPicture.overrideSprite = null; } #if UNITY_IPHONE UnityEngine.iOS.NotificationServices.RegisterForNotifications(UnityEngine.iOS.NotificationType.Alert | UnityEngine.iOS.NotificationType.Badge | UnityEngine.iOS.NotificationType.Sound, true); #endif if (PF_PlayerData.isRegisteredForPush == true) { this.isRegisteredForPush = true; this.registerPush.GetComponent <Image> ().overrideSprite = this.checkedBox; } else { this.isRegisteredForPush = false; this.registerPush.GetComponent <Image>().overrideSprite = this.uncheckedBox; } } }