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); } } } } }
private static void RestoreDefaults(DynamicBookPages.ItemLinkedPage linkedPage) { if (linkedPage == null) { return; } linkedPage.RestoreDefaults(); }
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); } }