public void InitMissionList()
    {
        this.m_combatAllyListItem.get_gameObject().SetActive(false);
        MiniMissionListItem[] componentsInChildren = this.m_availableMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        MiniMissionListItem[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            MiniMissionListItem miniMissionListItem = array[i];
            bool flag = true;
            if (PersistentMissionData.missionDictionary.ContainsKey(miniMissionListItem.GetMissionID()))
            {
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(miniMissionListItem.GetMissionID());
                if (jamGarrisonMobileMission.MissionState == 0)
                {
                    flag = false;
                    miniMissionListItem.UpdateMechanicPreview(false, jamGarrisonMobileMission);
                }
            }
            if (flag)
            {
                Object.DestroyImmediate(miniMissionListItem.get_gameObject());
            }
        }
        componentsInChildren = this.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        MiniMissionListItem[] array2 = componentsInChildren;
        for (int j = 0; j < array2.Length; j++)
        {
            MiniMissionListItem miniMissionListItem2 = array2[j];
            bool flag2 = true;
            if (PersistentMissionData.missionDictionary.ContainsKey(miniMissionListItem2.GetMissionID()))
            {
                JamGarrisonMobileMission jamGarrisonMobileMission2 = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary.get_Item(miniMissionListItem2.GetMissionID());
                if (jamGarrisonMobileMission2.MissionState != 0)
                {
                    flag2 = false;
                }
            }
            if (flag2)
            {
                Object.DestroyImmediate(miniMissionListItem2.get_gameObject());
            }
        }
        MiniMissionListItem[] componentsInChildren2 = this.m_availableMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        MiniMissionListItem[] componentsInChildren3 = this.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        IEnumerator           enumerator            = PersistentMissionData.missionDictionary.get_Values().GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                JamGarrisonMobileMission jamGarrisonMobileMission3 = (JamGarrisonMobileMission)enumerator.get_Current();
                bool flag3 = false;
                MiniMissionListItem[] array3 = componentsInChildren2;
                for (int k = 0; k < array3.Length; k++)
                {
                    MiniMissionListItem miniMissionListItem3 = array3[k];
                    if (miniMissionListItem3.GetMissionID() == jamGarrisonMobileMission3.MissionRecID)
                    {
                        flag3 = true;
                        break;
                    }
                }
                if (!flag3)
                {
                    MiniMissionListItem[] array4 = componentsInChildren3;
                    for (int l = 0; l < array4.Length; l++)
                    {
                        MiniMissionListItem miniMissionListItem4 = array4[l];
                        if (miniMissionListItem4.GetMissionID() == jamGarrisonMobileMission3.MissionRecID)
                        {
                            flag3 = true;
                            break;
                        }
                    }
                }
                if (!flag3)
                {
                    GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission3.MissionRecID);
                    if (record == null)
                    {
                        Debug.LogWarning("Mission Not Found: ID " + jamGarrisonMobileMission3.MissionRecID);
                    }
                    else if (record.GarrFollowerTypeID == 4u)
                    {
                        if ((record.Flags & 16u) != 0u)
                        {
                            this.m_combatAllyListItem.get_gameObject().SetActive(true);
                        }
                        else
                        {
                            GameObject gameObject = Object.Instantiate <GameObject>(this.m_miniMissionListItemPrefab);
                            if (jamGarrisonMobileMission3.MissionState == 0)
                            {
                                gameObject.get_transform().SetParent(this.m_availableMission_listContents.get_transform(), false);
                            }
                            else
                            {
                                gameObject.get_transform().SetParent(this.m_inProgressMission_listContents.get_transform(), false);
                            }
                            MiniMissionListItem component = gameObject.GetComponent <MiniMissionListItem>();
                            component.SetMission(jamGarrisonMobileMission3);
                            AutoHide autoHide = gameObject.AddComponent <AutoHide>();
                            autoHide.m_clipRT = base.get_gameObject().GetComponent <RectTransform>();
                        }
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
        componentsInChildren2 = this.m_availableMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        componentsInChildren3 = this.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        int num  = componentsInChildren2.Length;
        int num2 = componentsInChildren3.Length;

        this.m_availableMissionsTabLabel.set_text(StaticDB.GetString("AVAILABLE", null) + " - " + num);
        this.m_inProgressMissionsTabLabel.set_text(StaticDB.GetString("IN_PROGRESS", null) + " - " + num2);
        this.m_noMissionsAvailableLabel.get_gameObject().SetActive(num == 0);
        this.m_noMissionsInProgressLabel.get_gameObject().SetActive(num2 == 0);
    }
Example #2
0
    public void InitMissionList()
    {
        this.m_combatAllyListItem.gameObject.SetActive(false);
        MiniMissionListItem[] componentsInChildren = this.m_availableMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        foreach (MiniMissionListItem miniMissionListItem in componentsInChildren)
        {
            bool flag = true;
            if (PersistentMissionData.missionDictionary.ContainsKey(miniMissionListItem.GetMissionID()))
            {
                JamGarrisonMobileMission jamGarrisonMobileMission = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[miniMissionListItem.GetMissionID()];
                if (jamGarrisonMobileMission.MissionState == 0)
                {
                    flag = false;
                    miniMissionListItem.UpdateMechanicPreview(false, jamGarrisonMobileMission);
                }
            }
            if (flag)
            {
                Object.DestroyImmediate(miniMissionListItem.gameObject);
            }
        }
        componentsInChildren = this.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        foreach (MiniMissionListItem miniMissionListItem2 in componentsInChildren)
        {
            bool flag2 = true;
            if (PersistentMissionData.missionDictionary.ContainsKey(miniMissionListItem2.GetMissionID()))
            {
                JamGarrisonMobileMission jamGarrisonMobileMission2 = (JamGarrisonMobileMission)PersistentMissionData.missionDictionary[miniMissionListItem2.GetMissionID()];
                if (jamGarrisonMobileMission2.MissionState != 0)
                {
                    flag2 = false;
                }
            }
            if (flag2)
            {
                Object.DestroyImmediate(miniMissionListItem2.gameObject);
            }
        }
        MiniMissionListItem[] componentsInChildren2 = this.m_availableMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        MiniMissionListItem[] componentsInChildren3 = this.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        IEnumerator           enumerator            = PersistentMissionData.missionDictionary.Values.GetEnumerator();

        try
        {
            while (enumerator.MoveNext())
            {
                object obj = enumerator.Current;
                JamGarrisonMobileMission jamGarrisonMobileMission3 = (JamGarrisonMobileMission)obj;
                bool flag3 = false;
                foreach (MiniMissionListItem miniMissionListItem3 in componentsInChildren2)
                {
                    if (miniMissionListItem3.GetMissionID() == jamGarrisonMobileMission3.MissionRecID)
                    {
                        flag3 = true;
                        break;
                    }
                }
                if (!flag3)
                {
                    foreach (MiniMissionListItem miniMissionListItem4 in componentsInChildren3)
                    {
                        if (miniMissionListItem4.GetMissionID() == jamGarrisonMobileMission3.MissionRecID)
                        {
                            flag3 = true;
                            break;
                        }
                    }
                }
                if (!flag3)
                {
                    GarrMissionRec record = StaticDB.garrMissionDB.GetRecord(jamGarrisonMobileMission3.MissionRecID);
                    if (record == null)
                    {
                        Debug.LogWarning("Mission Not Found: ID " + jamGarrisonMobileMission3.MissionRecID);
                    }
                    else if (record.GarrFollowerTypeID == 4u)
                    {
                        if ((record.Flags & 16u) != 0u)
                        {
                            this.m_combatAllyListItem.gameObject.SetActive(true);
                        }
                        else
                        {
                            GameObject gameObject = Object.Instantiate <GameObject>(this.m_miniMissionListItemPrefab);
                            if (jamGarrisonMobileMission3.MissionState == 0)
                            {
                                gameObject.transform.SetParent(this.m_availableMission_listContents.transform, false);
                            }
                            else
                            {
                                gameObject.transform.SetParent(this.m_inProgressMission_listContents.transform, false);
                                this.ShowMissionStartedAnim();
                            }
                            MiniMissionListItem component = gameObject.GetComponent <MiniMissionListItem>();
                            component.SetMission(jamGarrisonMobileMission3);
                        }
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable;
            if ((disposable = (enumerator as IDisposable)) != null)
            {
                disposable.Dispose();
            }
        }
        componentsInChildren2 = this.m_availableMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        componentsInChildren3 = this.m_inProgressMission_listContents.GetComponentsInChildren <MiniMissionListItem>(true);
        int num  = componentsInChildren2.Length;
        int num2 = componentsInChildren3.Length;

        this.m_availableMissionsTabLabel.text  = StaticDB.GetString("AVAILABLE", null) + " - " + num;
        this.m_inProgressMissionsTabLabel.text = StaticDB.GetString("IN_PROGRESS", null) + " - " + num2;
        this.m_noMissionsAvailableLabel.gameObject.SetActive(num == 0);
        this.m_noMissionsInProgressLabel.gameObject.SetActive(num2 == 0);
    }