Example #1
0
        private void EnterChapter(bool enter)
        {
            this.leftButton.SetActive(enter);
            this.rightButton.SetActive(enter);
            this.scrollRect.set_horizontal(enter);
            if (this.currentSectionID >= this.mItems.Count)
            {
                return;
            }
            SGWorldBannerItem component = (SGWorldBannerItem)((Component)this.mItems[this.currentSectionID]).GetComponent <SGWorldBannerItem>();

            if (!Object.op_Inequality((Object)component, (Object)null))
            {
                return;
            }
            if (!enter)
            {
                ChapterParam area = MonoSingleton <GameManager> .Instance.FindArea((string)GlobalVars.SelectedChapter);

                if (area == null)
                {
                    return;
                }
                component.SetChapterText(area.name);
            }
            else
            {
                component.SetChapterText(string.Empty);
            }
        }
Example #2
0
        private void Refresh()
        {
            GameUtility.DestroyGameObjects <ListItemEvents>(this.mItems);
            if (Object.op_Equality((Object)this.ItemTemplate, (Object)null) || Object.op_Equality((Object)this.ItemContainer, (Object)null))
            {
                return;
            }
            GameManager instance = MonoSingleton <GameManager> .Instance;
            PlayerData  player   = instance.Player;

            SectionParam[] sections    = instance.Sections;
            List <string>  stringList1 = new List <string>();
            List <string>  stringList2 = new List <string>();
            long           serverTime  = Network.GetServerTime();

            QuestParam[] availableQuests = player.AvailableQuests;
            for (int index = 0; index < availableQuests.Length; ++index)
            {
                if (!string.IsNullOrEmpty(availableQuests[index].ChapterID) && !stringList1.Contains(availableQuests[index].ChapterID) && (!availableQuests[index].IsMulti && availableQuests[index].IsDateUnlock(serverTime)))
                {
                    stringList1.Add(availableQuests[index].ChapterID);
                }
            }
            for (int index = 0; index < stringList1.Count; ++index)
            {
                ChapterParam area = instance.FindArea(stringList1[index]);
                if (area != null && !stringList2.Contains(area.section))
                {
                    stringList2.Add(area.section);
                }
            }
            for (int index = 0; index < sections.Length; ++index)
            {
                SectionParam sectionParam = sections[index];
                if (sections[index].IsDateUnlock() && stringList2.Contains(sections[index].iname))
                {
                    ListItemEvents listItemEvents1 = (ListItemEvents)null;
                    if (!string.IsNullOrEmpty(sectionParam.prefabPath))
                    {
                        StringBuilder stringBuilder = GameUtility.GetStringBuilder();
                        stringBuilder.Append("QuestSections/");
                        stringBuilder.Append(sectionParam.prefabPath);
                        listItemEvents1 = AssetManager.Load <ListItemEvents>(stringBuilder.ToString());
                    }
                    if (Object.op_Equality((Object)listItemEvents1, (Object)null))
                    {
                        listItemEvents1 = this.ItemTemplate;
                    }
                    ListItemEvents listItemEvents2 = (ListItemEvents)Object.Instantiate <ListItemEvents>((M0)listItemEvents1);
                    DataSource.Bind <UIQuestSectionData>(((Component)listItemEvents2).get_gameObject(), new UIQuestSectionData(sections[index]));
                    ((Component)listItemEvents2).get_transform().SetParent(this.ItemContainer.get_transform(), false);
                    ((Component)listItemEvents2).get_gameObject().SetActive(true);
                    listItemEvents2.OnSelect = new ListItemEvents.ListItemEvent(this.OnItemSelect);
                    SGWorldBannerItem component = (SGWorldBannerItem)((Component)listItemEvents2).GetComponent <SGWorldBannerItem>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        ChapterParam area = MonoSingleton <GameManager> .Instance.FindArea((string)GlobalVars.SelectedChapter);

                        if (area != null && area.section == sections[index].iname)
                        {
                            component.SetChapterText(area.name);
                            this.currentSectionID = index;
                        }
                    }
                    this.mItems.Add(listItemEvents2);
                }
            }
        }