private void SetStateIcon(ChallengeMissionItem.State value)
        {
            if (Object.op_Equality((Object)this.IconChallenge, (Object)null) || Object.op_Equality((Object)this.IconClear, (Object)null) || Object.op_Equality((Object)this.IconNext, (Object)null))
            {
                return;
            }
            this.IconChallenge.SetActive(false);
            this.IconClear.SetActive(false);
            this.IconNext.SetActive(false);
            switch (value)
            {
            case ChallengeMissionItem.State.Challenge:
                this.IconChallenge.SetActive(true);
                break;

            case ChallengeMissionItem.State.Clear:
                this.IconClear.SetActive(true);
                break;

            case ChallengeMissionItem.State.Next:
                this.IconNext.SetActive(true);
                break;
            }
        }
Exemple #2
0
        public void Refresh()
        {
            ((Component)this).get_gameObject().SetActive(true);
            ((Component)this.ClearBadge).get_gameObject().SetActive(false);
            GameManager instanceDirect = MonoSingleton <GameManager> .GetInstanceDirect();

            TrophyParam dataOfClass = DataSource.FindDataOfClass <TrophyParam>(((Component)this).get_gameObject(), (TrophyParam)null);

            if (UnityEngine.Object.op_Equality((UnityEngine.Object)instanceDirect, (UnityEngine.Object)null) || dataOfClass == null)
            {
                ((Component)this.ButtonHighlight.button).get_gameObject().SetActive(false);
                ((Component)this.ButtonNormal.button).get_gameObject().SetActive(false);
                ((Component)this.ButtonSecret.button).get_gameObject().SetActive(true);
            }
            else
            {
                TrophyState trophyCounter        = ChallengeMission.GetTrophyCounter(dataOfClass);
                ChallengeMissionItem.State state = ChallengeMissionItem.State.Challenge;
                if (trophyCounter.IsEnded)
                {
                    state = ChallengeMissionItem.State.Ended;
                }
                else if (trophyCounter.IsCompleted)
                {
                    state = ChallengeMissionItem.State.Clear;
                }
                ChallengeMissionItem.ButtonObject buttonObject;
                if (state == ChallengeMissionItem.State.Clear)
                {
                    ((Component)this.ButtonHighlight.button).get_gameObject().SetActive(true);
                    ((Component)this.ButtonNormal.button).get_gameObject().SetActive(false);
                    ((Component)this.ButtonSecret.button).get_gameObject().SetActive(false);
                    buttonObject = this.ButtonHighlight;
                }
                else
                {
                    ((Component)this.ButtonHighlight.button).get_gameObject().SetActive(false);
                    ((Component)this.ButtonNormal.button).get_gameObject().SetActive(true);
                    ((Component)this.ButtonSecret.button).get_gameObject().SetActive(false);
                    buttonObject = this.ButtonNormal;
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ClearBadge, (UnityEngine.Object)null))
                {
                    ((Component)this.ClearBadge).get_gameObject().SetActive(state == ChallengeMissionItem.State.Ended);
                }
                if (buttonObject != null && UnityEngine.Object.op_Inequality((UnityEngine.Object)buttonObject.title, (UnityEngine.Object)null))
                {
                    buttonObject.title.set_text(dataOfClass.Name);
                }
                if (buttonObject != null && UnityEngine.Object.op_Inequality((UnityEngine.Object)buttonObject.button, (UnityEngine.Object)null))
                {
                    ((UnityEventBase)buttonObject.button.get_onClick()).RemoveAllListeners();
                    ((UnityEvent)buttonObject.button.get_onClick()).AddListener(this.OnClick);
                    ((Selectable)buttonObject.button).set_interactable(state != ChallengeMissionItem.State.Ended);
                }
                if (buttonObject != null && UnityEngine.Object.op_Inequality((UnityEngine.Object)buttonObject.reward, (UnityEngine.Object)null))
                {
                    if (dataOfClass.Gold != 0)
                    {
                        buttonObject.reward.set_text(string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_GOLD"), (object)dataOfClass.Gold));
                        GameUtility.SetGameObjectActive((Component)buttonObject.icon, true);
                        GameUtility.SetGameObjectActive((Component)buttonObject.conceptCardIcon, false);
                    }
                    else if (dataOfClass.Exp != 0)
                    {
                        buttonObject.reward.set_text(string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_EXP"), (object)dataOfClass.Exp));
                        GameUtility.SetGameObjectActive((Component)buttonObject.icon, true);
                        GameUtility.SetGameObjectActive((Component)buttonObject.conceptCardIcon, false);
                    }
                    else if (dataOfClass.Coin != 0)
                    {
                        buttonObject.reward.set_text(string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_COIN"), (object)dataOfClass.Coin));
                        GameUtility.SetGameObjectActive((Component)buttonObject.icon, true);
                        GameUtility.SetGameObjectActive((Component)buttonObject.conceptCardIcon, false);
                    }
                    else if (dataOfClass.Stamina != 0)
                    {
                        buttonObject.reward.set_text(string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_STAMINA"), (object)dataOfClass.Stamina));
                        GameUtility.SetGameObjectActive((Component)buttonObject.icon, true);
                        GameUtility.SetGameObjectActive((Component)buttonObject.conceptCardIcon, false);
                    }
                    else if (dataOfClass.Items != null && dataOfClass.Items.Length > 0)
                    {
                        GameUtility.SetGameObjectActive((Component)buttonObject.icon, true);
                        GameUtility.SetGameObjectActive((Component)buttonObject.conceptCardIcon, false);
                        ItemParam itemParam = instanceDirect.GetItemParam(dataOfClass.Items[0].iname);
                        if (itemParam != null)
                        {
                            buttonObject.reward.set_text(string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_ITEM"), (object)itemParam.name, (object)dataOfClass.Items[0].Num));
                        }
                    }
                    else if (dataOfClass.ConceptCards != null && dataOfClass.ConceptCards.Length > 0)
                    {
                        GameUtility.SetGameObjectActive((Component)buttonObject.icon, false);
                        GameUtility.SetGameObjectActive((Component)buttonObject.conceptCardIcon, true);
                        ConceptCardParam conceptCardParam = instanceDirect.MasterParam.GetConceptCardParam(dataOfClass.ConceptCards[0].iname);
                        if (conceptCardParam != null)
                        {
                            buttonObject.reward.set_text(string.Format(LocalizedText.Get("sys.CHALLENGE_DETAIL_REWARD_CONCEPT_CARD"), (object)conceptCardParam.name, (object)dataOfClass.ConceptCards[0].Num));
                        }
                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)buttonObject.conceptCardIcon, (UnityEngine.Object)null))
                        {
                            ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(conceptCardParam.iname);
                            buttonObject.conceptCardIcon.Setup(cardDataForDisplay);
                        }
                    }
                }
                if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)buttonObject.icon, (UnityEngine.Object)null))
                {
                    return;
                }
                buttonObject.icon.UpdateValue();
            }
        }
        public void Refresh()
        {
            GameManager instanceDirect = MonoSingleton <GameManager> .GetInstanceDirect();

            TrophyParam dataOfClass = DataSource.FindDataOfClass <TrophyParam>(((Component)this).get_gameObject(), (TrophyParam)null);

            if (Object.op_Equality((Object)instanceDirect, (Object)null) || dataOfClass == null)
            {
                ((Behaviour)this).set_enabled(false);
            }
            else
            {
                TrophyState trophyCounter1 = ChallengeMission.GetTrophyCounter(dataOfClass);
                if (trophyCounter1.IsEnded)
                {
                    ((Component)this).get_gameObject().SetActive(false);
                }
                else
                {
                    ((Component)this).get_gameObject().SetActive(true);
                    ChallengeMissionItem.State state = ChallengeMissionItem.State.Challenge;
                    if (dataOfClass.RequiredTrophies != null && dataOfClass.RequiredTrophies.Length > 0)
                    {
                        TrophyParam trophy = ChallengeMission.GetTrophy(dataOfClass.RequiredTrophies[0]);
                        if (trophy != null)
                        {
                            TrophyState trophyCounter2 = ChallengeMission.GetTrophyCounter(trophy);
                            state = !trophyCounter2.IsEnded ? (!trophyCounter2.IsCompleted ? ChallengeMissionItem.State.None : ChallengeMissionItem.State.Next) : ChallengeMissionItem.State.Challenge;
                        }
                    }
                    if (trophyCounter1.IsCompleted)
                    {
                        state = ChallengeMissionItem.State.Clear;
                    }
                    this.SetStateIcon(state);
                    ChallengeMissionItem.ButtonObject buttonObject;
                    if (state == ChallengeMissionItem.State.Clear)
                    {
                        ((Component)this.ButtonHighlight.button).get_gameObject().SetActive(true);
                        ((Component)this.ButtonNormal.button).get_gameObject().SetActive(false);
                        buttonObject = this.ButtonHighlight;
                    }
                    else
                    {
                        ((Component)this.ButtonHighlight.button).get_gameObject().SetActive(false);
                        ((Component)this.ButtonNormal.button).get_gameObject().SetActive(true);
                        buttonObject = this.ButtonNormal;
                    }
                    if (buttonObject != null && Object.op_Inequality((Object)buttonObject.title, (Object)null))
                    {
                        if (state == ChallengeMissionItem.State.None)
                        {
                            buttonObject.title.set_text(LocalizedText.Get("sys.CHALLENGE_LOCKED"));
                        }
                        else
                        {
                            buttonObject.title.set_text(dataOfClass.Name);
                        }
                    }
                    if (buttonObject != null && Object.op_Inequality((Object)buttonObject.button, (Object)null))
                    {
                        ((UnityEventBase)buttonObject.button.get_onClick()).RemoveAllListeners();
                        ((UnityEvent)buttonObject.button.get_onClick()).AddListener(this.OnClick);
                        ((Selectable)buttonObject.button).set_interactable(state == ChallengeMissionItem.State.Challenge || state == ChallengeMissionItem.State.Clear);
                    }
                    if (buttonObject == null || !Object.op_Inequality((Object)buttonObject.reward, (Object)null))
                    {
                        return;
                    }
                    if (dataOfClass.Gold != 0)
                    {
                        buttonObject.reward.set_text(string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_GOLD"), (object)dataOfClass.Gold));
                    }
                    else if (dataOfClass.Exp != 0)
                    {
                        buttonObject.reward.set_text(string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_EXP"), (object)dataOfClass.Exp));
                    }
                    else if (dataOfClass.Coin != 0)
                    {
                        buttonObject.reward.set_text(string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_COIN"), (object)dataOfClass.Coin));
                    }
                    else if (dataOfClass.Stamina != 0)
                    {
                        buttonObject.reward.set_text(string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_STAMINA"), (object)dataOfClass.Stamina));
                    }
                    else
                    {
                        if (dataOfClass.Items == null || dataOfClass.Items.Length <= 0)
                        {
                            return;
                        }
                        ItemParam itemParam = instanceDirect.GetItemParam(dataOfClass.Items[0].iname);
                        if (itemParam == null)
                        {
                            return;
                        }
                        buttonObject.reward.set_text(itemParam.name);
                    }
                }
            }
        }