private void Refresh(bool fromRefresh)
        {
            this.mShowingOverlay = false;
            bool        flag1             = false;
            TrophyState trophyState       = (TrophyState)null;
            TrophyParam currentRootTrophy = ChallengeMission.GetCurrentRootTrophy();

            if (currentRootTrophy == null)
            {
                return;
            }
            foreach (TrophyParam currentTrophy in ChallengeMission.GetCurrentTrophies(currentRootTrophy))
            {
                TrophyState trophyCounter = ChallengeMission.GetTrophyCounter(currentTrophy);
                if (!trophyCounter.IsEnded)
                {
                    if (!trophyCounter.IsCompleted)
                    {
                        ;
                    }
                    DataSource.Bind <TrophyParam>(((Component)this).get_gameObject(), currentTrophy);
                    DataSource.Bind <TrophyState>(((Component)this).get_gameObject(), trophyCounter);
                    trophyState = trophyCounter;
                    flag1       = true;
                    this.RefreshRewardIcon(currentTrophy);
                    break;
                }
            }
            if (!flag1)
            {
                this.RefreshRewardIcon(currentRootTrophy);
                DataSource.Bind <TrophyParam>(((Component)this).get_gameObject(), currentRootTrophy);
                TrophyState trophyCounter = ChallengeMission.GetTrophyCounter(currentRootTrophy);
                if (trophyCounter != null)
                {
                    DataSource.Bind <TrophyState>(((Component)this).get_gameObject(), trophyCounter);
                }
            }
            if (!((Component)this).get_gameObject().get_activeSelf())
            {
                ((Component)this).get_gameObject().SetActive(true);
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
            bool flag2 = !flag1;

            if (trophyState != null)
            {
                flag2 = trophyState.IsCompleted;
            }
            if (!Object.op_Inequality((Object)this.ButtonTry, (Object)null) || !Object.op_Inequality((Object)this.ButtonDetail, (Object)null) || (!Object.op_Inequality((Object)this.ButtonReward, (Object)null) || !Object.op_Inequality((Object)this.ButtonHelp, (Object)null)))
            {
                return;
            }
            ((Component)this.ButtonTry).get_gameObject().SetActive(!flag2);
            ((Component)this.ButtonDetail).get_gameObject().SetActive(!flag2);
            ((Component)this.ButtonReward).get_gameObject().SetActive(flag2);
            ((Component)this.ButtonHelp).get_gameObject().SetActive(!flag2);
        }
예제 #2
0
        public static TrophyParam GetTopMostPriorityTrophy(ChallengeCategoryParam[] categories)
        {
            TrophyParam trophyParam1 = (TrophyParam)null;
            TrophyParam trophyParam2 = (TrophyParam)null;
            TrophyParam trophyParam3 = (TrophyParam)null;

            foreach (ChallengeCategoryParam category in categories)
            {
                bool        flag = true;
                TrophyParam currentRootTrophy = ChallengeMission.GetCurrentRootTrophy(category.iname);
                if (currentRootTrophy != null)
                {
                    foreach (TrophyParam childeTrophy in ChallengeMission.GetChildeTrophies(currentRootTrophy))
                    {
                        TrophyState trophyCounter = ChallengeMission.GetTrophyCounter(childeTrophy);
                        if (!trophyCounter.IsEnded)
                        {
                            flag = false;
                            if (trophyCounter.IsCompleted)
                            {
                                if (trophyParam2 == null)
                                {
                                    trophyParam2 = childeTrophy;
                                }
                            }
                            else if (trophyParam1 == null)
                            {
                                trophyParam1 = childeTrophy;
                            }
                        }
                    }
                    TrophyState trophyCounter1 = ChallengeMission.GetTrophyCounter(currentRootTrophy);
                    if (!trophyCounter1.IsEnded)
                    {
                        if (flag)
                        {
                            if (trophyParam3 == null)
                            {
                                trophyParam3 = currentRootTrophy;
                            }
                        }
                        else if (trophyCounter1.IsCompleted)
                        {
                            if (trophyParam2 == null)
                            {
                                trophyParam2 = currentRootTrophy;
                            }
                        }
                        else if (trophyParam1 == null)
                        {
                            trophyParam1 = currentRootTrophy;
                        }
                    }
                }
            }
            return(trophyParam3 ?? trophyParam2 ?? trophyParam1);
        }
예제 #3
0
        private void Refresh(bool doInitialize, bool autoCategorySelection, bool changeCategory = false)
        {
            string category;

            if (autoCategorySelection)
            {
                category = ChallengeMission.GetTopMostPriorityCategory(this.mCategories);
                int index = Array.FindIndex <ChallengeCategoryParam>(this.mCategories, (Predicate <ChallengeCategoryParam>)(cat => cat.iname == category));
                this.mCurrentCategoryIndex = index >= 0 ? index : 0;
            }
            else
            {
                category = this.mCategories[this.mCurrentCategoryIndex].iname;
            }
            for (int index = 0; index < this.mCategoryButtons.Count; ++index)
            {
                ((Component)this.mCategoryButtons[index].SelectionFrame).get_gameObject().SetActive(index == this.mCurrentCategoryIndex);
            }
            if (doInitialize)
            {
                for (int index = 0; index < this.mCategories.Length && index < this.mCategoryButtons.Count; ++index)
                {
                    bool        flag1             = false;
                    bool        flag2             = true;
                    TrophyParam currentRootTrophy = ChallengeMission.GetCurrentRootTrophy(this.mCategories[index].iname);
                    bool        flag3;
                    if (currentRootTrophy != null)
                    {
                        foreach (TrophyParam childeTrophy in ChallengeMission.GetChildeTrophies(currentRootTrophy))
                        {
                            TrophyState trophyCounter = ChallengeMission.GetTrophyCounter(childeTrophy);
                            if (!trophyCounter.IsEnded)
                            {
                                flag2 = false;
                                if (trophyCounter.IsCompleted)
                                {
                                    flag1 = true;
                                    break;
                                }
                            }
                        }
                        TrophyState trophyCounter1 = ChallengeMission.GetTrophyCounter(currentRootTrophy);
                        flag3 = flag1 || flag2 && !trophyCounter1.IsEnded;
                    }
                    else
                    {
                        flag3 = false;
                    }
                    ((Component)this.mCategoryButtons[index].Badge).get_gameObject().SetActive(flag3);
                }
            }
            TrophyParam[] rootTropies       = ChallengeMission.GetRootTropies(category);
            int           activeTrophyIndex = ChallengeMission.GetCurrentActiveTrophyIndex(rootTropies);

            if (doInitialize || changeCategory)
            {
                this.mCurrentPage = activeTrophyIndex;
            }
            TrophyParam trophyParam = rootTropies[this.mCurrentPage];

            this.mRootCount = rootTropies.Length;
            this.PageNumText.set_text((this.mCurrentPage + 1).ToString());
            this.PageMaxNumText.set_text(this.mRootCount.ToString());
            this.ChangeRewardImage(trophyParam);
            this.PageDotTemplate.SetActive(false);
            using (List <GameObject> .Enumerator enumerator = this.mDotsList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    UnityEngine.Object.Destroy((UnityEngine.Object)enumerator.Current);
                }
            }
            this.mDotsList.Clear();
            for (int index = 0; index < this.mRootCount; ++index)
            {
                GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.PageDotTemplate);
                this.mDotsList.Add(gameObject);
                gameObject.SetActive(true);
                ((Toggle)gameObject.GetComponent <Toggle>()).set_isOn(index == this.mCurrentPage);
                gameObject.get_transform().SetParent(this.PageDotsHolder.get_transform(), false);
            }
            ((Selectable)this.BackPageButton).set_interactable(true);
            ((Selectable)this.NextPageButton).set_interactable(true);
            if (this.mCurrentPage <= 0)
            {
                ((Selectable)this.BackPageButton).set_interactable(false);
            }
            if (this.mCurrentPage >= this.mRootCount - 1)
            {
                ((Selectable)this.NextPageButton).set_interactable(false);
            }
            if (this.mCurrentPage > activeTrophyIndex)
            {
                this.OpenNonAchievedPage(this.mCurrentPage);
            }
            else
            {
                this.OpenNewPage(trophyParam, doInitialize);
            }
        }