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 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 RedeemCoupon() { UnityAction <string> afterPrompt = (string response) => { if (!string.IsNullOrEmpty(response)) { PF_GamePlay.RedeemCoupon(response); } }; DialogCanvasController.RequestTextInputPrompt("Redeem a Coupon Code", "Enter a valid code to redeem rewards.", (string response) => { afterPrompt(response); }, "XXX-XXXX-XXX"); }
public void SetTitleId() { UnityAction <string> afterPrompt = (string response) => { if (!string.IsNullOrEmpty(response)) { this.activeTitleId.text = response; PlayFab.PlayFabSettings.TitleId = response; PlayerPrefs.SetString("TitleId", response); } }; DialogCanvasController.RequestTextInputPrompt("Set Title Id", "This will update which PlayFab title this client connects to.", (string response) => { afterPrompt(response); }, PlayFab.PlayFabSettings.TitleId); }
public void PonyPicked(ArrowUI pony) { Action <string> processResponse = (string response) => { if (response != null) { //ShowButtons(); PF_PlayerData.CreateNewCharacter(response, pony.details); } }; string[] randomNames = new string[] { "Sparkle", "Twinkle", "PowerHoof", "Nova", "Lightning", "ReignBow", "Charlie", "Balloonicorn", "Roach" }; int rng = UnityEngine.Random.Range(0, randomNames.Length); DialogCanvasController.RequestTextInputPrompt(GlobalStrings.CHAR_NAME_PROMPT, GlobalStrings.CHAR_NAME_MSG, processResponse, randomNames[rng]); }
public void OnAddCustomTagClicked() { Action <string> afterInput = (string response) => { if (!string.IsNullOrEmpty(response)) { if (this.activeFriend.Tags == null) { this.activeFriend.Tags = new List <string>(); } AddTagItemUI(response, this.activeFriend.Tags.Count); // since we are adding 1 immediately .Count works fine this.activeFriend.Tags.Add(response); this.didCustomTagsChange = true; } }; DialogCanvasController.RequestTextInputPrompt(GlobalStrings.FRIEND_TAG_PROMPT, GlobalStrings.FRIEND_TAG_MSG, afterInput); }
public void AddFriendClicked() { UnityAction <int> afterSelect = (int response) => { Action <string> afterInput = (string input) => { PF_PlayerData.AddFriend(input, (PF_PlayerData.AddFriendMethod)response, (bool result) => { if (result) { Dictionary <string, object> eventData = new Dictionary <string, object>(); // no real data to be sent with this event, just sending an empty dict for now... PF_Bridge.LogCustomEvent(PF_Bridge.CustomEventTypes.Client_FriendAdded, eventData); PF_PlayerData.GetFriendsList(() => { UpdateFriendList(); }); } }); }; DialogCanvasController.RequestTextInputPrompt(GlobalStrings.ADD_FRIEND_PROMPT, string.Format(GlobalStrings.ADD_FRIEND_MSG, (PF_PlayerData.AddFriendMethod)response), afterInput); }; DialogCanvasController.RequestSelectorPrompt(GlobalStrings.FRIEND_SELECTOR_PROMPT, Enum.GetNames(typeof(PF_PlayerData.AddFriendMethod)).ToList(), afterSelect); }
public void TransferVC() { // specify Currency Code // enter currency amount // select recipient string cCode = ""; int amount = 0; //if player, show picker for valid characters //if character, show picker for valid characters + Player List <string> transOptions = new List <string>(); UnityAction <int> afterSelect = (int response) => { if (this.activeMode == InventoryMode.Character && response == 0) // stand alone { // send this to the player account Debug.Log("Moved " + amount + cCode + " to Player"); PF_PlayerData.TransferVcToPlayer(PF_PlayerData.activeCharacter.characterDetails.CharacterId, cCode, amount, RefreshInventory); } else { string sourceType = "Player"; if (this.activeMode == InventoryMode.Character) // stand alone { // remove the player option since 0 was not selected transOptions.RemoveAt(0); response--; sourceType = "Character"; } Debug.Log("Moved " + amount + cCode + " to Character: " + transOptions[response] + " -- " + PF_PlayerData.playerCharacters[response].CharacterId); PF_PlayerData.TransferVCToCharacter(PF_PlayerData.activeCharacter.characterDetails.CharacterId, sourceType, cCode, amount, PF_PlayerData.playerCharacters[response].CharacterId, RefreshInventory); } }; Action <string> afterSetAmount = (string response) => { if (string.IsNullOrEmpty(response)) { return; //user canceled. } if (!Int32.TryParse(response, out amount) || response == "0") { PF_Bridge.RaiseCallbackError("Please enter an interger > 0 for VC amount", PlayFabAPIMethods.Generic, MessageDisplayStyle.error); } else { if (this.activeMode == InventoryMode.Character) { transOptions.Add("Player"); } foreach (var c in PF_PlayerData.playerCharacters) { if (this.activeMode == InventoryMode.Character && c.CharacterId == PF_PlayerData.activeCharacter.characterDetails.CharacterId) { //Probably better logic for this, and I should feel sad (but i dont). } else { transOptions.Add(c.CharacterName); } } DialogCanvasController.RequestSelectorPrompt("Choose a recipient", transOptions, afterSelect); } }; UnityAction <int> afterSelectCC = (int response) => { cCode = this.currenciesInUse[response]; DialogCanvasController.RequestTextInputPrompt("Set an amount to transfer:", "Enter the amount that you wish to send.", afterSetAmount, "0"); }; DialogCanvasController.RequestSelectorPrompt("Select a VC:", this.currenciesInUse, afterSelectCC); }