public void ChangeTab(JournalTab tab) { if (activeContentItem != null) { activeContentItem.GetComponent <Image>().color = Color.gray; activeContentItem = null; } activeTab.GetComponent <Image>().color = Color.gray; tab.GetComponent <Image>().color = Color.green; //set all the active content items to false Debug.Log("Active items list: " + activeContentItems.Count); for (int i = 0; i < activeContentItems.Count; i++) { disabledContentItems.Add(activeContentItems[i]); activeContentItems[i].SetActive(false); //activeContentItems.RemoveAt(0); //Debug.Log("Removing.................."); } activeContentItems.Clear(); indexLinksToAllItemsInJournal.Clear(); //Links to the items in journal lists cleared activeTab = tab; itemsDisplayed.Clear(); RefreshContentInActiveTab(); }
private void Start() { itemsInJournal = new List <System.Object>(); itemsIcons = new List <Sprite>(); itemsDescriptions = new List <string>(); itemsDisplayed = new List <string>(); journalTabs = new List <JournalTab>(); activeContentItems = new List <GameObject>(); indexLinksToAllItemsInJournal = new List <int>(); disabledContentItems = new List <GameObject>(); journalTabs.AddRange(GetComponentsInChildren <JournalTab>()); activeTab = journalTabs[0]; itemsPanel = transform.Find("Items Panel").gameObject; contentPanel = itemsPanel.transform.Find("Content Panel").gameObject; descriptionPanel = transform.Find("Description Panel").gameObject; descriptionIcon = descriptionPanel.transform.Find("Icon").GetComponent <Image>(); descriptionTitle = descriptionPanel.transform.Find("Title").GetComponent <Text>(); descriptionSummary = descriptionPanel.transform.Find("Summary").GetComponent <Text>(); ItemBase.ItemPickedUpEvent += ItemPickedUp; heightOfContent = contentPrefab.GetComponent <RectTransform>().sizeDelta.y; RefreshContentInActiveTab(); gameObject.SetActive(false); }