private bool NotebookTabIsOpen(NotebookTab tab) { NotebookUI notebook = GameManager.Instance.NotebookUI; NotebookTabPicker picker = notebook.TabPicker; return(notebook.IsOpen && picker.CurrentTab == tab); }
public void Initialize(Item item, bool displayPrice, ItemSelectedHandler itemSelectedHandler) { this.item = item; this.itemImage.sprite = item.Icon; this.ItemName.text = this.item.ItemID.Data.Name.Get(global::ItemName.Type.Colloquial); // Display the price PriceRoot.SetActive(displayPrice); if (displayPrice) { PriceText.text = item.Price.ToString(); } // Check if the selected handler is null. If not then add it to the event if (itemSelectedHandler != null) { this.onSelected += itemSelectedHandler; } RequestButton.onClick.AddListener(() => { if (GameManager.Instance) { // Reference the notebook ui NotebookUI notebookUI = GameManager.Instance.NotebookUI; // Tab picker reference NotebookTabPicker tabPicker = notebookUI.TabPicker; // Create the bookmark to navigate to Bookmark bookmark = new Bookmark(string.Empty, new BookmarkData(tabPicker.name, NotebookTab.Concepts)); // Create a request to prefill in the notebook ResourceRequest request = new ResourceRequest() { QuantityRequested = 1, ItemRequested = item.ItemID }; notebookUI.NavigateToBookmark(bookmark); notebookUI.FillResourceRequest(request); } }); }