public void GetTrophies()
        {
            if (TrophyIdsField.text.IndexOf(',') == -1)
            {
                Debug.Log("Get Single Trophy. Click to see source.");

                var trophyId = TrophyIdsField.text != string.Empty ? int.Parse(TrophyIdsField.text) : 0;
                Trophies.Get(trophyId, PrintTrophy);
            }
            else
            {
                Debug.Log("Get Multiple Trophies. Click to see source.");

                var trophyIDs = ParseIds(TrophyIdsField.text);

                Trophies.Get(trophyIDs, trophies => {
                    if (trophies != null)
                    {
                        foreach (var trophy in trophies.Reverse())
                        {
                            PrintTrophy(trophy);
                        }
                        AddConsoleLine("Found {0} trophies.", trophies.Length);
                    }
                });
            }
        }
Exemple #2
0
        public override void Show(Action <bool> callback)
        {
            Animator.SetTrigger("Trophies");
            Animator.SetTrigger("ShowLoadingIndicator");
            this.callback = callback;

            Trophies.Get(trophies => {
                if (trophies != null)
                {
                    trophies = trophies.Where(x => !x.IsSecret || x.Unlocked).ToArray();
                    // Create children if there are not enough
                    while (Container.childCount < trophies.Length)
                    {
                        var tr = Instantiate(TrophyItem).transform;
                        tr.SetParent(Container);
                        tr.SetAsLastSibling();
                    }

                    // Update children's text.
                    for (int i = 0; i < trophies.Length; ++i)
                    {
                        Container.GetChild(i).GetComponent <TrophyItem>().Init(trophies[i]);
                    }

                    Animator.SetTrigger("HideLoadingIndicator");
                    Animator.SetTrigger("Unlock");
                }
                else
                {
                    // TODO: Show error notification
                    Animator.SetTrigger("HideLoadingIndicator");
                    Dismiss(false);
                }
            });
        }
        public void GetTrophiesByStatus()
        {
            Debug.Log("Get Trophies by Status (Unlocked or not). Click to see source.");

            Trophies.Get(UnlockedTrophiesOnlyToggle.isOn, trophies => {
                if (trophies != null)
                {
                    foreach (var trophy in trophies.Reverse())
                    {
                        PrintTrophy(trophy);
                    }
                    AddConsoleLine("Found {0} trophies.", trophies.Length);
                }
            });
        }
        public void GetAllTrophies()
        {
            Debug.Log("Get All Trophies. Click to see source.");

            Trophies.Get(trophies => {
                if (trophies != null)
                {
                    foreach (var trophy in trophies.Reverse())
                    {
                        PrintTrophy(trophy);
                    }
                    AddConsoleLine("Found {0} trophies.", trophies.Length);
                }
            });
        }