private void OnExhibitVisited(ExhibitTag exhibitTag) { for (int i = 0; i < ExhibitButtons.Length; i++) { ExhibitButton exhibitButton = ExhibitButtons[i]; if (exhibitButton.ExhibitTag == exhibitTag) { Image iconImage = exhibitButton.transform.GetChild(0).GetComponent <Image>(); Color temporaryColor = iconImage.color; temporaryColor.a = 1f; iconImage.color = temporaryColor; exhibitButton.gameObject.tag = "Visited"; } } }
//Button OnClick event public void PreviousPage() { int numberOfPreviousPage = pageNumber - 1; if (numberOfPreviousPage >= 0) { pageNumber--; for (int i = 0; i < exhibitButtonManager.ExhibitButtons.Length; i++) { if ((int)exhibitButtonManager.ExhibitButtons[i].ExhibitTag == pageNumber) { ExhibitButton exhibitButton = exhibitButtonManager.ExhibitButtons[i]; PopulateJournalInfo(exhibitButton); } } } }
//Button OnClick event public void NextPage() { int numberOfNextPage = pageNumber + 1; if (numberOfNextPage < exhibitButtonManager.ExhibitButtons.Length) { pageNumber++; for (int i = 0; i < exhibitButtonManager.ExhibitButtons.Length; i++) { if ((int)exhibitButtonManager.ExhibitButtons[i].ExhibitTag == pageNumber) { ExhibitButton exhibitButton = exhibitButtonManager.ExhibitButtons[i]; PopulateJournalInfo(exhibitButton); } } } }
private void PopulateJournalInfo(ExhibitButton exhibitButton) { exhibitTitle.text = exhibitButton.Title; exhibitImage.sprite = exhibitButton.ExhibitImage; if (exhibitButton.gameObject.tag == "Visited") { exhibitText.text = exhibitButton.ExhibitText; } else { exhibitText.text = defaultExhibitText; } if (!journalCanvas.gameObject.activeInHierarchy) { journalCanvas.gameObject.SetActive(true); } }
//Button OnClick event public void OpenJournal(ExhibitButton exhibitButton) { pageNumber = (int)exhibitButton.ExhibitTag; PopulateJournalInfo(exhibitButton); }