Esempio n. 1
0
        private void OnMonsterSelected(Object p_sender, EventArgs p_args)
        {
            BookEntry bookEntry = p_sender as BookEntry;

            if (bookEntry == null)
            {
                return;
            }
            m_monsterName.enabled = true;
            Int32 entryID = bookEntry.EntryID;

            foreach (BookEntry bookEntry2 in m_pageableList.EntryList)
            {
                bookEntry2.SetSelected(entryID);
            }
            Int32 num = 0;

            if (m_bestiaryHandler.AllMonsters.TryGetValue(entryID, out num))
            {
                if (num > 0)
                {
                    bookEntry.IsNewEntry = false;
                    m_bestiaryHandler.RemoveFromNewEntries(entryID);
                    MonsterStaticData staticData = StaticDataHandler.GetStaticData <MonsterStaticData>(EDataType.MONSTER, entryID);
                    if (staticData.Grade == EMonsterGrade.BOSS || staticData.Grade == EMonsterGrade.CHAMPION)
                    {
                        NGUITools.SetActiveSelf(m_championInfo, true);
                        NGUITools.SetActiveSelf(m_infoController.gameObject, false);
                        m_infoController.ShowProgressBar(false);
                        m_monsterName.text = LocaManager.GetText(staticData.NameKey);
                        col.center         = m_boxColliderChampionPos;
                        col.size           = m_boxColliderChampionSize;
                    }
                    else
                    {
                        NGUITools.SetActiveSelf(m_championInfo, false);
                        NGUITools.SetActiveSelf(m_infoController.gameObject, true);
                        m_infoController.Show();
                        m_monsterName.text = LocaManager.GetText(staticData.NameKey);
                        m_infoController.SetEntry(staticData, m_bestiaryHandler.AllMonsters[staticData.StaticID]);
                        m_infoController.ShowProgressBar(true);
                        col.center = m_boxColliderNormalPos;
                        col.size   = m_boxColliderNormalSize;
                    }
                    if ((staticData.StaticID >= 35 && staticData.StaticID <= 37) || staticData.Type == EMonsterType.MINOTAUR || staticData.Type == EMonsterType.MINOTAUR_GUARD)
                    {
                        m_fakeScene.DisplayMonsterPrefab(staticData.Prefab, ESize.MEDIUM);
                    }
                    else
                    {
                        m_fakeScene.DisplayMonsterPrefab(staticData.Prefab, staticData.Size);
                    }
                }
                else
                {
                    m_infoController.Hide();
                    m_monsterName.text = "?????";
                }
            }
            else
            {
                m_infoController.Hide();
                m_monsterName.text = "?????";
            }
        }
Esempio n. 2
0
        private Int32 UpdateBookList()
        {
            CleanupPageableList();
            m_bookTextLabel.Hide();
            m_firstPageContent.SetActive(false);
            m_bookTextLabel.Hide();
            m_titleLabel.enabled = false;
            if (m_bookCoverImage.mainTexture != null)
            {
                Texture mainTexture = m_bookCoverImage.mainTexture;
                m_bookCoverImage.mainTexture = null;
                if (mainTexture != null)
                {
                    mainTexture.UnloadAsset();
                }
            }
            m_categoryCoverImage.enabled = true;
            m_headerLabel.enabled        = true;
            NGUITools.SetActive(m_checkBox.gameObject, true);
            NGUITools.SetActive(m_pageableList.gameObject, true);
            Int32   numberOfBookForCategory = m_loreBookHandler.GetNumberOfBookForCategory((ELoreBookCategories)m_categoryTabs.CurrentTabIndex);
            Int32   num     = 0;
            String  text    = "LorebookCoverArt/ART_lore_category_" + ((ELoreBookCategories)m_categoryTabs.CurrentTabIndex).ToString().ToLower();
            Texture texture = (Texture)Resources.Load(text);

            if (texture == null)
            {
                Debug.LogError("Could not load texture from: " + text);
            }
            if (m_categoryCoverImage.mainTexture != texture)
            {
                Texture mainTexture2 = m_categoryCoverImage.mainTexture;
                m_categoryCoverImage.mainTexture = texture;
                if (mainTexture2 != null)
                {
                    mainTexture2.UnloadAsset();
                }
            }
            m_pageLabel.enabled = false;
            List <LoreBookStaticData> booksForCategory = m_loreBookHandler.GetBooksForCategory((ELoreBookCategories)m_categoryTabs.CurrentTabIndex, m_checkBox.isChecked);

            for (Int32 i = m_pageableList.CurrentIndex; i < m_pageableList.EndIndex; i++)
            {
                BookEntry entry = m_pageableList.GetEntry();
                entry.IsActive = true;
                if (i < booksForCategory.Count)
                {
                    if (!m_checkBox.isChecked)
                    {
                        entry.Init(booksForCategory[i].StaticID, LocaManager.GetText(booksForCategory[i].TitleKey));
                        entry.IsNewEntry      = m_loreBookHandler.NewEntries.Contains(booksForCategory[i].StaticID);
                        entry.OnBookSelected += OnBookSelected;
                        num++;
                    }
                    else if (m_loreBookHandler.FoundBooks.Contains(booksForCategory[i]))
                    {
                        entry.Init(booksForCategory[i].StaticID, LocaManager.GetText(booksForCategory[i].TitleKey));
                        entry.OnBookSelected += OnBookSelected;
                        entry.IsNewEntry      = m_loreBookHandler.NewEntries.Contains(booksForCategory[i].StaticID);
                        num++;
                    }
                    else
                    {
                        entry.Init(booksForCategory[i].StaticID, "?????");
                        entry.IsNewEntry = false;
                        entry.IsActive   = false;
                    }
                }
                else
                {
                    entry.Init(0, String.Empty);
                }
            }
            m_headerLabel.text = LocaManager.GetText("TT_LORE_CATEGORY_" + ((ELoreBookCategories)m_categoryTabs.CurrentTabIndex).ToString());
            if (!m_checkBox.isChecked)
            {
                return(booksForCategory.Count);
            }
            return(numberOfBookForCategory);
        }
Esempio n. 3
0
        public Int32 InitList(EMonsterClass p_monsterClass)
        {
            m_monsterName.enabled = false;
            m_infoController.Hide();
            CleanupPageableList();
            Int32   num             = 0;
            Int32   num2            = 0;
            Boolean p_showChampions = m_categoryTabs.CurrentTabIndex == m_categoryTabs.Tabs.Length - 1;
            Dictionary <Int32, Int32> monstersForCategory = m_bestiaryHandler.GetMonstersForCategory(p_monsterClass, p_showChampions);
            Dictionary <Int32, Int32> dictionary          = new Dictionary <Int32, Int32>();

            foreach (Int32 num3 in monstersForCategory.Keys)
            {
                if (StaticDataHandler.GetStaticData <MonsterStaticData>(EDataType.MONSTER, num3) != null)
                {
                    Int32 num4 = 0;
                    if (monstersForCategory.TryGetValue(num3, out num4))
                    {
                        if (num4 > 0)
                        {
                            num++;
                        }
                        if (num4 != 0 || m_checkBox.isChecked)
                        {
                            dictionary.Add(num3, monstersForCategory[num3]);
                        }
                    }
                }
            }
            Int32[] array = dictionary.Keys.ToArray <Int32>();
            for (Int32 i = m_pageableList.CurrentIndex; i < m_pageableList.EndIndex; i++)
            {
                if (i < dictionary.Count)
                {
                    Int32             num5       = array[i];
                    BookEntry         entry      = m_pageableList.GetEntry();
                    MonsterStaticData staticData = StaticDataHandler.GetStaticData <MonsterStaticData>(EDataType.MONSTER, num5);
                    if (staticData == null)
                    {
                        entry.OnBookSelected += OnMonsterSelected;
                        entry.Init(num5, "[FF0000]MISSING DATA[-]");
                        entry.IsNewEntry = false;
                        entry.IsActive   = false;
                        num2++;
                    }
                    Int32 num6 = dictionary[num5];
                    if (!m_checkBox.isChecked)
                    {
                        if (num6 > 0)
                        {
                            entry.OnBookSelected += OnMonsterSelected;
                            entry.Init(num5, LocaManager.GetText(staticData.NameKey));
                            entry.IsNewEntry = m_bestiaryHandler.NewEntries.Contains(num5);
                            num2++;
                        }
                    }
                    else
                    {
                        entry.OnBookSelected += OnMonsterSelected;
                        if (num6 > 0)
                        {
                            entry.Init(num5, LocaManager.GetText(staticData.NameKey));
                            entry.IsNewEntry = m_bestiaryHandler.NewEntries.Contains(num5);
                            num2++;
                        }
                        else
                        {
                            entry.Init(num5, "?????");
                            entry.IsNewEntry = false;
                            entry.IsActive   = false;
                            num2++;
                        }
                    }
                }
                else
                {
                    BookEntry entry2 = m_pageableList.GetEntry();
                    entry2.Init(0, String.Empty);
                    entry2.IsNewEntry = false;
                }
            }
            BookEntry bookEntry = m_pageableList.TrySelectActiveEntryOnPage();

            if (bookEntry != null)
            {
                OnMonsterSelected(bookEntry, EventArgs.Empty);
            }
            return(dictionary.Count);
        }
Esempio n. 4
0
        private Int32 UpdateQuestList(EQuestType p_type)
        {
            CleanupPageableList();
            m_questType = p_type;
            Boolean          flag = false;
            List <QuestStep> stepsByState;

            if (m_showFinished.isChecked)
            {
                stepsByState = LegacyLogic.Instance.WorldManager.QuestHandler.GetStepsByState(EQuestState.ACTIVE);
                stepsByState.AddRange(LegacyLogic.Instance.WorldManager.QuestHandler.GetStepsByState(EQuestState.SOLVED));
            }
            else
            {
                stepsByState = LegacyLogic.Instance.WorldManager.QuestHandler.GetStepsByState(EQuestState.ACTIVE);
            }
            List <QuestStep> list = new List <QuestStep>();

            foreach (QuestStep questStep in stepsByState)
            {
                Boolean flag2 = false;
                if (p_type == EQuestType.ALL)
                {
                    flag2 = true;
                }
                else if (p_type == EQuestType.QUEST_TYPE_MAIN && questStep.StaticData.Type == p_type)
                {
                    flag2 = true;
                }
                else if (p_type == EQuestType.QUEST_TYPE_ONGOING && questStep.StaticData.Type == p_type)
                {
                    flag2 = true;
                }
                else if (p_type == EQuestType.QUEST_TYPE_SIDE && (questStep.StaticData.Type == EQuestType.QUEST_TYPE_GRANDMASTER || questStep.StaticData.Type == EQuestType.QUEST_TYPE_PROMOTION || questStep.StaticData.Type == EQuestType.QUEST_TYPE_REPEATABLE || questStep.StaticData.Type == EQuestType.QUEST_TYPE_SIDE))
                {
                    flag2 = true;
                }
                if (flag2)
                {
                    if (m_selectedQuestStep != null && m_selectedQuestStep == questStep)
                    {
                        flag = true;
                    }
                    list.Add(questStep);
                }
            }
            for (Int32 i = m_pageableList.CurrentIndex; i < m_pageableList.EndIndex; i++)
            {
                if (i < list.Count)
                {
                    QuestStep questStep2 = list[i];
                    BookEntry entry      = m_pageableList.GetEntry();
                    entry.Init(questStep2.StaticData.StaticID, questStep2.StaticData.Name);
                    QuestEntry questEntry  = entry;
                    QuestEntry questEntry2 = questEntry;
                    questEntry2.OnQuestClicked = (EventHandler)Delegate.Combine(questEntry2.OnQuestClicked, new EventHandler(QuestClick));
                    questEntry.RestorePositions();
                    questEntry.SetQuestStep(questStep2);
                }
                else
                {
                    BookEntry entry2 = m_pageableList.GetEntry();
                    entry2.Init(0, String.Empty);
                }
            }
            if (list.Count > 0)
            {
                if (flag)
                {
                    QuestClick(m_selectedQuestStep, EventArgs.Empty);
                }
                else
                {
                    m_selectedQuestStep = null;
                    QuestClick(m_pageableList.EntryList[0].GetQuestStep(), EventArgs.Empty);
                }
            }
            else
            {
                ClearDetails();
            }
            return(list.Count);
        }