private ConditionalHighlight HighlightHighlightButton() { // Cache some useful values NotebookUI notebook = GameManager.Instance.NotebookUI; ResearchEncyclopediaArticleInputField inputField = notebook.GetComponentInChildren <ResearchEncyclopediaArticleInputField>(true); RectTransform highlightPicker = FindRectTransformInChildren(notebook.TabPicker.GetTabRoot(NotebookTab.Research), "HighlightPicker"); return(new ConditionalHighlight() { predicate = () => !inputField.IsHighlighting, target = () => highlightPicker }); }
private void FreezeUntilHighlightAbsent(ItemID item, int articleIndex, TextHighlight targetHighlight) { NotebookUI notebook = GameManager.Instance.NotebookUI; ResearchEncyclopediaArticleInputField inputField = notebook.GetComponentInChildren <ResearchEncyclopediaArticleInputField>(true); // Get the list of all highlights in this encyclopedia article List <TextHighlight> highlights = notebook .Data.Research.GetEntry(item) .GetArticleData(articleIndex).Highlights; FreezingScheduler.FreezeUntilConditionIsMet(() => { // Get an index of any highlight that overlaps the target highlight int indexOfMatch = highlights.FindIndex(current => targetHighlight.Overlap(current)); // Freeze until no overlapping highlights found and notebook is open to research tab return(indexOfMatch < 0 && notebook.IsOpen && notebook.TabPicker.CurrentTab == NotebookTab.Research); }); HighlightingScheduler.SetHighlights(HighlightNotebookButton(), HighlightNotebookTabButton(NotebookTab.Research), HighlightEraseButton()); }