public void FreezeUntilGoatPlacedMaplePlacedAndDaysAdvanced() { bool GoatsExist() => PopulationExists(SpeciesType.Goat, 3); bool GoatsDontExist() => !GoatsExist(); bool MaplesExist() => FoodSourceExists("Space Maple", 2); bool MaplesDontExist() => !MaplesExist(); FreezingScheduler.FreezeUntilConditionIsMet(() => { return(GoatsExist() && MaplesExist() && GameManager.Instance.CurrentDay >= 3 && PopulationIsInspected(SpeciesType.Goat)); }); HighlightingScheduler.SetHighlights( // Prompt player to put down some goats HighlightBuildButton(true), HighlightBuildSectionPicker(2), HighlightBuildItem <PodSection>(new ItemID(ItemRegistry.Category.Species, 0)), ConditionalHighlight.NoTarget(GoatsDontExist), // Prompt player to put down some maples HighlightBuildSectionPicker(0), HighlightBuildItem <FoodSourceStoreSection>(new ItemID(ItemRegistry.Category.Food, 0)), ConditionalHighlight.NoTarget(MaplesDontExist), // Prompt player to advance a few days HighlightBuildButton(false), HighlightNextDayButton(() => GameManager.Instance.CurrentDay >= 3), // Prompt player to use the inspector to inspect the goats HighlightInspectorButton()); }
private void FreezeUntilNotebookTabOpen(NotebookTab tab) { // Freeze until notebook tab is open FreezingScheduler.FreezeUntilConditionIsMet(() => NotebookTabIsOpen(tab)); // Highlight notebook button if not open, then highlight correct tab HighlightingScheduler.SetHighlights(HighlightNotebookButton(), HighlightNotebookTabButton(tab)); }
private void FreezeUntilBuildItemPicked <StoreSectionType>(ItemID targetItem, int storeSectionIndex) where StoreSectionType : StoreSection { // Freeze until the menu is in store, the store section is picked and the item selected is the target item FreezingScheduler.FreezeUntilConditionIsMet(() => BuildItemIsPicked <StoreSectionType>(targetItem, storeSectionIndex)); // Set the highlights for the build button, the section picker, and the item in that section HighlightingScheduler.SetHighlights(HighlightBuildButton(true), HighlightBuildSectionPicker(storeSectionIndex), HighlightBuildItem <StoreSectionType>(targetItem)); }
private void FreezeUntilNotebookItemPicked(NotebookTab targetTab, ItemID targetItem, string nameFilter) { FreezingScheduler.FreezeUntilConditionIsMet(() => NotebookItemPicked(targetTab, targetItem, nameFilter)); // Highlight notebook button if not open, then highlight correct tab HighlightingScheduler.SetHighlights(HighlightNotebookButton(), // Highlight the correct tab HighlightNotebookTabButton(targetTab), // Highlight the dropdown in the picker HighlightItemPicker(targetTab, targetItem, nameFilter)[0], HighlightItemPicker(targetTab, targetItem, nameFilter)[1]); }
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 }); }
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()); }
private void FreezeUntilHighlightPresent(ItemID item, int articleIndex, TextHighlight targetHighlight) { // Cache some useful values NotebookUI notebook = GameManager.Instance.NotebookUI; // Get the list of all highlights in this encyclopedia article List <TextHighlight> highlights = notebook .Data.Research.GetEntry(item) .GetArticleData(articleIndex).Highlights; FreezingScheduler.FreezeUntilConditionIsMet(() => { // Get index of a highlight that this highlight contains int indexOfMatch = highlights.FindIndex(current => current.Contains(targetHighlight)); // Freeze until highlight is found and notebook is open to research tab return(indexOfMatch >= 0 && notebook.IsOpen && notebook.TabPicker.CurrentTab == NotebookTab.Research); }); HighlightingScheduler.SetHighlights(HighlightNotebookButton(), HighlightNotebookTabButton(NotebookTab.Research), HighlightHighlightButton()); }
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 }); }
public void FreezeUntilZeigPopulationIncrease() { // Find the next day button RectTransform nextDay = FindRectTransform("NextDay"); // Get the current population PopulationManager populationManager = GameManager.Instance.m_populationManager; int currentGoats = populationManager.TotalPopulationSize(SpeciesType.Goat); // Population increased if current population exceeds population computed just now bool PopulationIncrease() { return(populationManager.TotalPopulationSize(SpeciesType.Goat) > currentGoats); } FreezingScheduler.FreezeUntilConditionIsMet(PopulationIncrease); HighlightingScheduler.SetHighlights(new ConditionalHighlight() { predicate = PopulationIncrease, invert = true, target = () => nextDay }); }
public void FreezeUntilNotebookOpen() { HighlightingScheduler.SetHighlights(HighlightNotebookButton()); FreezingScheduler.FreezeUntilConditionIsMet(() => GameManager.Instance.NotebookUI.IsOpen); }
private void FreezeUntilPopulationIsInspected(SpeciesType targetSpecies) { FreezingScheduler.FreezeUntilConditionIsMet(() => PopulationIsInspected(targetSpecies)); HighlightingScheduler.SetHighlights(HighlightInspectorButton()); }
public void FreezeUntilInspectorOpened() { FreezingScheduler.FreezeUntilConditionIsMet(() => GameManager.Instance.m_inspector.IsInInspectorMode); HighlightingScheduler.SetHighlights(HighlightInspectorButton()); }
public void FreezeUntilZeigsExist(int numZeigs) { FreezingScheduler.FreezeUntilConditionIsMet(() => PopulationExists(SpeciesType.Goat, numZeigs)); }
public void FreezeUntilBuildUIClosed() { FreezingScheduler.FreezeUntilConditionIsMet(() => !GameManager.Instance.m_menuManager.IsInStore); HighlightingScheduler.SetHighlights(HighlightBuildButton(false)); }