Beispiel #1
0
        public void Init(LoreBookStaticData p_data)
        {
            m_loreBookId    = p_data.StaticID;
            m_loreBookTitle = LocaManager.GetText(p_data.TitleKey);
            m_category      = p_data.Category;
            Color yellow = Color.yellow;

            base.Init(m_loreBookTitle, m_bookIconName, 0, yellow);
        }
Beispiel #2
0
 public void AddLoreBook(Int32 p_staticID, Boolean p_fromSaveGame)
 {
     if (p_staticID != 0)
     {
         LoreBookStaticData staticData = StaticDataHandler.GetStaticData <LoreBookStaticData>(EDataType.LOREBOOK, p_staticID);
         if (!m_foundBooks.Contains(staticData))
         {
             m_foundBooks.Add(staticData);
             String text  = Localization.Instance.GetText(staticData.TitleKey);
             String text2 = Localization.Instance.GetText("GAME_MESSSAGE_LOREBOOK_ADDED", text);
             GameMessageEventArgs p_eventArgs = new GameMessageEventArgs(text2, 0f, false);
             if (!p_fromSaveGame)
             {
                 m_newEntries.Add(p_staticID);
                 LegacyLogic.Instance.EventManager.InvokeEvent(null, EEventType.GAME_MESSAGE, p_eventArgs);
                 LegacyLogic.Instance.EventManager.InvokeEvent(staticData, EEventType.ADD_LOREBOOK, EventArgs.Empty);
             }
         }
     }
 }
Beispiel #3
0
        public void OnBookSelected(Int32 p_selected)
        {
            LoreBookStaticData loreBookStaticData = null;

            m_pageLabel.enabled = true;
            m_firstPageContent.SetActive(true);
            m_titleLabel.enabled = true;
            if (m_categoryCoverImage.mainTexture != null)
            {
                Texture mainTexture = m_categoryCoverImage.mainTexture;
                m_categoryCoverImage.mainTexture = null;
                if (mainTexture != null)
                {
                    mainTexture.UnloadAsset();
                }
            }
            m_categoryCoverImage.enabled = false;
            m_headerLabel.enabled        = false;
            NGUITools.SetActive(m_checkBox.gameObject, false);
            NGUITools.SetActive(m_pageableList.gameObject, false);
            m_pageableList.CurrentIndex = 0;
            foreach (LoreBookStaticData loreBookStaticData2 in m_foundBooks)
            {
                if (loreBookStaticData2.StaticID == p_selected)
                {
                    loreBookStaticData = loreBookStaticData2;
                    break;
                }
            }
            if (loreBookStaticData == null)
            {
                return;
            }
            Int32 currentTabIndex = m_categoryTabs.CurrentTabIndex;

            m_categoryTabs.Tabs[currentTabIndex].SetActive(false, true);
            m_categoryTabs.CurrentTabIndex = m_categoryTabs.Tabs.Length;
            m_titleLabel.text  = LocaManager.GetText(loreBookStaticData.TitleKey);
            m_authorLabel.text = LocaManager.GetText(loreBookStaticData.AuthorKey);
            m_bookTextLabel.SetInternalText(LocaManager.GetText(loreBookStaticData.TextKey));
            String  text    = "LorebookCoverArt/" + loreBookStaticData.ImageName;
            Texture texture = (Texture)Resources.Load(text);

            if (texture == null)
            {
                Debug.LogError("Could not load texture from: " + text);
            }
            if (m_bookCoverImage.mainTexture != texture)
            {
                Texture mainTexture2 = m_bookCoverImage.mainTexture;
                m_bookCoverImage.mainTexture = texture;
                if (mainTexture2 != null)
                {
                    mainTexture2.UnloadAsset();
                }
            }
            if (m_bookTextLabel.PageCount <= 1)
            {
                m_pageLabel.enabled = false;
            }
            else
            {
                m_pageLabel.text = LocaManager.GetText("SPELLBOOK_PAGE", m_bookTextLabel.CurrentPage + 1, m_bookTextLabel.PageCount);
            }
            m_bookTextLabel.Show();
            m_loreBookHandler.RemoveFromNewEntries(p_selected);
            CleanupPageableList();
        }
        private void OnLorebookAdded(Object p_sender, EventArgs p_args)
        {
            LoreBookStaticData item = p_sender as LoreBookStaticData;

            m_loreBookQueue.Enqueue(item);
        }