public void CategoryFilterClicked()
    {
        UnityAction <int> afterSelect = (int response) =>
        {
            if (response == 0)             // stand alone
            {
                CategoryFilter.GetComponentInChildren <Text>().text = "Standalone";
                this.ActiveOptions = this.StandAloneStatistics;

                this.QuestContainer.gameObject.SetActive(false);
                this.StatsContainer.anchoredPosition = new Vector2(this.QuestContainer.anchoredPosition.x + 5, this.QuestContainer.anchoredPosition.y);
            }
            else if (response == 1)             // per quest
            {
                CategoryFilter.GetComponentInChildren <Text>().text = "Per Quest";
                this.ActiveOptions = this.QuestStatistics;

                this.StatsContainer.anchoredPosition = new Vector2(this.StatsContainer.anchoredPosition.x + this.StatsContainer.rect.width, this.StatsContainer.anchoredPosition.y);
                this.QuestContainer.gameObject.SetActive(true);
            }
        };

        List <string> categories = new List <string>()
        {
            "Standalone", "Per Quest"
        };

        DialogCanvasController.RequestSelectorPrompt(GlobalStrings.CATEGORY_SELECTOR_PROMPT, categories, afterSelect);
    }
    public void StatisticFilterClicked()
    {
        UnityAction <int> afterSelect = (int response) =>
        {
            this.StatisticFilter.GetComponentInChildren <Text>().text = this.PlayerLevelStats[response];
            UpdateFriendsLB(this.PlayerLevelStats[response]);
            UpdateTop10LB(this.PlayerLevelStats[response]);
            //UpdateMyRank(this.PlayerLevelStats[response]);
        };

        DialogCanvasController.RequestSelectorPrompt(GlobalStrings.STAT_SELECTOR_PROMPT, this.PlayerLevelStats, afterSelect);
    }
    public void PlayEvent()
    {
        UnityAction <int> afterSelect = (int response) =>
        {
            Debug.Log("Starting Event #" + response + "...");
        };

        if (activePromo.linkedEvent.AssociatedLevels.Count > 1)
        {
            DialogCanvasController.RequestSelectorPrompt(GlobalStrings.QUEST_SELECTOR_PROMPT, activePromo.linkedEvent.AssociatedLevels, afterSelect);
        }
        else
        {
            afterSelect(0);
        }
    }
Exemplo n.º 4
0
    public void PlayEvent()
    {
        var levelNames = PF_GameData.GetEventAssociatedLevels(activePromo.EventKey);

        UnityAction <int> playEventIndex = index => {
            _levelPicker.LevelItemClicked(levelNames[index]);
            _levelPicker.PlaySelectedLevel();
        };

        if (levelNames.Count > 1)
        {
            DialogCanvasController.RequestSelectorPrompt(GlobalStrings.QUEST_SELECTOR_PROMPT, levelNames, playEventIndex);
        }
        else if (levelNames.Count == 1)
        {
            playEventIndex(0);
        }
    }
    public void QuestFilterClicked()
    {
        UnityAction <int> afterSelect = (int response) =>
        {
        };

        List <string> quests = new List <string>();

        if (PF_GameData.Levels.Count > 0)
        {
            foreach (var quest in PF_GameData.Levels)
            {
                this.Quests.Add(quest.Key);
            }
        }
        else
        {
            Debug.Log("No quests found...");
            return;
        }

        DialogCanvasController.RequestSelectorPrompt(GlobalStrings.QUEST_SELECTOR_PROMPT, quests, afterSelect);
    }
    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);
    }
Exemplo n.º 7
0
    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);
    }
Exemplo n.º 8
0
    public void TransferItem()
    {
        if (this.selectedItem.itemData.category.itemId == "ExtraCharacterSlot")
        {
            return;
        }

        //if player, show picker for valid characters
        //if character, show picker for valid characters + Player
        List <string> transOptions = new List <string>();

        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);
            }
        }

        UnityAction <int> afterSelect = (int response) =>
        {
            var item = this.selectedItem.itemData.category.inventory.FirstOrDefault();

            if (this.activeMode == InventoryMode.Character && response == 0) // stand alone
            {
                // send this to the player account
                Debug.Log("Moved " + item.DisplayName + " to Player");

                PF_PlayerData.TransferItemToPlayer(PF_PlayerData.activeCharacter.characterDetails.CharacterId, item.ItemInstanceId, 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";
                }

                // send this to another character
                if (item != null)
                {
                    Debug.Log("Moved " + item.DisplayName + " to Character: " + transOptions[response] + " -- " + PF_PlayerData.playerCharacters[response].CharacterId);
                    PF_PlayerData.TransferItemToCharacter(PF_PlayerData.activeCharacter.characterDetails.CharacterId, sourceType, item.ItemInstanceId, PF_PlayerData.playerCharacters[response].CharacterId, RefreshInventory);
                }
            }
        };

        DialogCanvasController.RequestSelectorPrompt("Choose a recipient", transOptions, afterSelect);
    }