コード例 #1
0
    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
        });
    }
コード例 #2
0
    private void FreezeUntilResourceRequestSubmitted(ItemID requestedItem, int requestQuantity)
    {
        // Grab a bunch of references to various scripts in the Notebook
        NotebookUI                     notebook              = GameManager.Instance.NotebookUI;
        ConceptsUI                     concepts              = notebook.GetComponentInChildren <ConceptsUI>(true);
        ResourceRequestEditor          requestEditor         = notebook.ResourceRequestEditor;
        ReviewedResourceRequestDisplay reviewDisplay         = notebook.GetComponentInChildren <ReviewedResourceRequestDisplay>(true);
        TMP_InputField                 quantityInput         = requestEditor.QuantityInput;
        ItemDropdown                   itemRequestedDropdown = requestEditor.ItemRequestedDropdown;

        // Freeze conversation until correct review was confirmed
        FreezingScheduler.FreezeUntilConditionIsMet(() => ResourceRequestWasSubmitted(requestedItem, requestQuantity), HighlightingScheduler.ClearHighlights);
        HighlightingScheduler.SetHighlights(HighlightNotebookButton(),
                                            HighlightNotebookTabButton(NotebookTab.Concepts),
                                            HighlightItemDropdown(itemRequestedDropdown, requestedItem)[0],
                                            HighlightItemDropdown(itemRequestedDropdown, requestedItem)[1],
                                            HighlightInputField(quantityInput, requestQuantity.ToString()),
                                            new ConditionalHighlight()
        {
            predicate = () => !reviewDisplay.gameObject.activeInHierarchy,
            target    = () => concepts.RequestButton.transform as RectTransform
        });
    }
コード例 #3
0
    public void FreezeUntilConceptCanvasExpanded(bool expanded)
    {
        NotebookUI       notebook = GameManager.Instance.NotebookUI;
        ConceptsCanvasUI canvas   = notebook.GetComponentInChildren <ConceptsCanvasUI>(true);

        FreezingScheduler.FreezeUntilConditionIsMet(() => NotebookTabIsOpen(NotebookTab.Concepts) && canvas.IsExpanded == expanded);
        HighlightingScheduler.SetHighlights(HighlightNotebookButton(),
                                            HighlightNotebookTabButton(NotebookTab.Concepts),
                                            new ConditionalHighlight()
        {
            predicate = () => canvas.IsExpanded != expanded,
            target    = () => canvas.FoldoutToggle.transform as RectTransform
        });
    }
コード例 #4
0
    private bool ResourceRequestWasSubmitted(ItemID requestedItem, int requestQuantity)
    {
        // Grab a bunch of references to various scripts in the Notebook
        NotebookUI notebook = GameManager.Instance.NotebookUI;
        ReviewedResourceRequestDisplay reviewDisplay = notebook.GetComponentInChildren <ReviewedResourceRequestDisplay>(true);
        ReviewedResourceRequest        review        = reviewDisplay.LastReviewConfirmed;

        // If there is a review that was just confirmed then check if it was the correct request
        if (review != null)
        {
            ResourceRequest request = review.Request;
            return(request.ItemRequested == requestedItem && request.QuantityRequested == requestQuantity);
        }
        else
        {
            return(false);
        }
    }
コード例 #5
0
    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());
    }