示例#1
0
        private IEnumerator UpdateLinksWorker()
        {
            for (int i = 0; i < this.Tabs.Count; i++)
            {
                this.Tabs[i].gameObject.SetActive(false);
            }
            yield return(null);

            yield return(null);

            int activeCount = 0;

            foreach (DynamicBookPages.ItemLinkedPage itemLinkedPage in this.Pages)
            {
                if (itemLinkedPage != null && !itemLinkedPage.Anchor)
                {
                    DynamicBookPages.UpdatePage(itemLinkedPage, this.Pages);
                    if (itemLinkedPage.Activated)
                    {
                        this.Tabs[activeCount].MyPageNew = itemLinkedPage.Page;
                        this.Tabs[activeCount].gameObject.SetActive(true);
                        activeCount++;
                    }
                }
            }
            yield break;
        }
示例#2
0
        private static void Deactivate(DynamicBookPages.ItemLinkedPage linkedPage, List <DynamicBookPages.ItemLinkedPage> allPages)
        {
            linkedPage.Activated = false;
            GameObject prevTarget          = linkedPage.GetPrevTarget();
            string     prevTargetLabelKey  = linkedPage.GetPrevTargetLabelKey();
            string     prevTargetLabelText = linkedPage.GetPrevTargetLabelText();
            GameObject nextTarget          = linkedPage.GetNextTarget();
            string     nextTargetLabelKey  = linkedPage.GetNextTargetLabelKey();
            string     nextTargetLabelText = linkedPage.GetNextTargetLabelText();

            foreach (DynamicBookPages.ItemLinkedPage itemLinkedPage in allPages)
            {
                if (itemLinkedPage != null)
                {
                    if (itemLinkedPage.NextButton != null && itemLinkedPage.NextButton.MyPageNew == linkedPage.Page)
                    {
                        itemLinkedPage.NextButton.MyPageNew = nextTarget;
                        if (itemLinkedPage.NextLabelTranslation != null)
                        {
                            itemLinkedPage.NextLabelTranslation._key = nextTargetLabelKey;
                            DynamicBookPages.RefreshLabelTranslation(itemLinkedPage.NextLabelTranslation, nextTargetLabelText);
                        }
                    }
                    if (itemLinkedPage.PrevButton != null && itemLinkedPage.PrevButton.MyPageNew == linkedPage.Page)
                    {
                        itemLinkedPage.PrevButton.MyPageNew = prevTarget;
                        if (itemLinkedPage.PrevLabelTranslation != null)
                        {
                            itemLinkedPage.PrevLabelTranslation._key = prevTargetLabelKey;
                            DynamicBookPages.RefreshLabelTranslation(itemLinkedPage.PrevLabelTranslation, prevTargetLabelText);
                        }
                    }
                }
            }
        }
示例#3
0
 private void OnDisable()
 {
     foreach (DynamicBookPages.ItemLinkedPage itemLinkedPage in this.Pages)
     {
         if (itemLinkedPage != null)
         {
             DynamicBookPages.RestoreDefaults(itemLinkedPage);
         }
     }
 }
示例#4
0
        private static void UpdatePage(DynamicBookPages.ItemLinkedPage linkedPage, List <DynamicBookPages.ItemLinkedPage> allPages)
        {
            if (LocalPlayer.Inventory == null || linkedPage.RequiredItemId == 0)
            {
                return;
            }
            bool flag = LocalPlayer.Inventory.Owns(linkedPage.RequiredItemId, true);

            if (flag == linkedPage.Activated)
            {
                return;
            }
            linkedPage.Activated = flag;
            if (!linkedPage.Activated)
            {
                DynamicBookPages.Deactivate(linkedPage, allPages);
            }
        }