Пример #1
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);
        }
Пример #2
0
 private bool IsNotReceiveRewards(TrophyParam rootTrophy)
 {
     foreach (TrophyParam childeTrophy in ChallengeMission.GetChildeTrophies(rootTrophy))
     {
         TrophyState trophyCounter = ChallengeMission.GetTrophyCounter(childeTrophy);
         if (trophyCounter.IsCompleted && !trophyCounter.IsEnded)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #3
0
        private void OpenNewPage(TrophyParam rootTrophy, bool doInitialize)
        {
            if (rootTrophy == null)
            {
                FlowNode_GameObject.ActivateOutputLinks((Component)this, 103);
            }
            else
            {
                TrophyParam[] childeTrophies = ChallengeMission.GetChildeTrophies(rootTrophy);
                if (childeTrophies.Length != this.Items.Count)
                {
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 103);
                }
                else
                {
                    ((Component)this.Shadow).get_gameObject().SetActive(false);
                    bool flag1 = false;
                    bool flag2 = true;
                    for (int index = 0; index < this.Items.Count; ++index)
                    {
                        // ISSUE: object of a compiler-generated type is created
                        // ISSUE: variable of a compiler-generated type
                        ChallengeMission.\u003COpenNewPage\u003Ec__AnonStorey30C pageCAnonStorey30C = new ChallengeMission.\u003COpenNewPage\u003Ec__AnonStorey30C();
                        // ISSUE: reference to a compiler-generated field
                        pageCAnonStorey30C.\u003C\u003Ef__this = this;
                        // ISSUE: reference to a compiler-generated field
                        pageCAnonStorey30C.trophy = childeTrophies[index];
                        // ISSUE: reference to a compiler-generated field
                        TrophyState trophyCounter = ChallengeMission.GetTrophyCounter(pageCAnonStorey30C.trophy);
                        if (!trophyCounter.IsEnded)
                        {
                            flag2 = false;
                            if (trophyCounter.IsCompleted)
                            {
                                flag1 = true;
                            }
                        }
                        // ISSUE: method pointer
                        this.Items[index].OnClick = new UnityAction((object)pageCAnonStorey30C, __methodptr(\u003C\u003Em__2A7));
                        // ISSUE: reference to a compiler-generated field
                        DataSource.Bind <TrophyParam>(((Component)this.Items[index]).get_gameObject(), pageCAnonStorey30C.trophy);
                        ItemParam data = (ItemParam)null;
                        // ISSUE: reference to a compiler-generated field
                        if (pageCAnonStorey30C.trophy.Coin != 0)
                        {
                            data = MonoSingleton <GameManager> .Instance.GetItemParam("$COIN");
                        }
                        else
                        {
                            // ISSUE: reference to a compiler-generated field
                            // ISSUE: reference to a compiler-generated field
                            if (pageCAnonStorey30C.trophy.Items != null && pageCAnonStorey30C.trophy.Items.Length > 0)
                            {
                                // ISSUE: reference to a compiler-generated field
                                data = MonoSingleton <GameManager> .Instance.GetItemParam(pageCAnonStorey30C.trophy.Items[0].iname);
                            }
                        }
                        if (data != null)
                        {
                            DataSource.Bind <ItemParam>(((Component)this.Items[index]).get_gameObject(), data);
                        }
                        this.Items[index].Refresh();
                    }
                    ((Component)this.CompleteBadge).get_gameObject().SetActive(flag2);
                    if (!flag2 && !doInitialize)
                    {
                        return;
                    }
                    TrophyState trophyCounter1 = ChallengeMission.GetTrophyCounter(rootTrophy);
                    if (this.UseCharMessage && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.MessageText, (UnityEngine.Object)null) && !trophyCounter1.IsEnded)
                    {
                        string str1 = (string)null;
                        if (flag1)
                        {
                            str1 = LocalizedText.Get("sys.CHALLENGE_MSG_CLEAR");
                        }
                        else if (PlayerPrefsUtility.GetInt(PlayerPrefsUtility.CHALLENGEMISSION_HAS_SHOW_MESSAGE, 0) == 0)
                        {
                            string str2 = string.Empty;
                            if (rootTrophy.Gold != 0)
                            {
                                str2 = string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_GOLD"), (object)rootTrophy.Gold);
                            }
                            else if (rootTrophy.Exp != 0)
                            {
                                str2 = string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_EXP"), (object)rootTrophy.Exp);
                            }
                            else if (rootTrophy.Coin != 0)
                            {
                                str2 = string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_COIN"), (object)rootTrophy.Coin);
                            }
                            else if (rootTrophy.Stamina != 0)
                            {
                                str2 = string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_STAMINA"), (object)rootTrophy.Stamina);
                            }
                            else if (rootTrophy.Items != null && rootTrophy.Items.Length > 0)
                            {
                                ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(rootTrophy.Items[0].iname);

                                if (itemParam != null)
                                {
                                    if (itemParam.type == EItemType.Unit)
                                    {
                                        UnitParam unitParam = MonoSingleton <GameManager> .Instance.GetUnitParam(itemParam.iname);

                                        if (unitParam != null)
                                        {
                                            str2 = LocalizedText.Get("sys.CHALLENGE_DETAIL_REWARD_UNIT", (object)((int)unitParam.rare + 1), (object)unitParam.name);
                                        }
                                    }
                                    else
                                    {
                                        str2 = LocalizedText.Get("sys.CHALLENGE_REWARD_ITEM", (object)itemParam.name, (object)rootTrophy.Items[0].Num);
                                    }
                                }
                            }
                            str1 = LocalizedText.Get("sys.CHALLENGE_MSG_INFO", new object[1]
                            {
                                (object)str2
                            });
                            PlayerPrefsUtility.SetInt(PlayerPrefsUtility.CHALLENGEMISSION_HAS_SHOW_MESSAGE, 1, false);
                        }
                        if (str1 != null)
                        {
                            this.MessageText.set_text(str1);
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.CharMessageWindow, (UnityEngine.Object)null))
                            {
                                this.ResetMessageCloseCoroutine();
                                this.CharMessageWindow.SetActive(true);
                                this.StartMessageCloseCoroutine();
                            }
                        }
                    }
                    if (!flag2 || trophyCounter1.IsEnded)
                    {
                        return;
                    }
                    MonoSingleton <GameManager> .GetInstanceDirect().Player.OnChallengeMissionComplete(rootTrophy.iname);

                    GlobalVars.SelectedChallengeMissionTrophy = rootTrophy.iname;
                    GlobalVars.SelectedTrophy.Set(rootTrophy.iname);
                    PlayerPrefsUtility.SetInt(PlayerPrefsUtility.CHALLENGEMISSION_HAS_SHOW_MESSAGE, 0, false);
                    if (rootTrophy.iname == "CHALLENGE_02")
                    {
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 104);
                    }
                    else
                    {
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 102);
                    }
                }
            }
        }
Пример #4
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);
            }
        }