protected void SetTopics(OnSetNotepadTopic e) { UIManager.instance.PNJState.Active(false); selectedNpc = e.npc; selectedDialogue = InteractablePNJ.DialoguesDatabase[selectedNpc.TxtInfo.NPCText]; int topicIndex = 0; foreach (ContractorTopic ct in ResourcesManager.Instance.contractTopics) { if (selectedDialogue.topicIDs.Contains(ct.id)) { int index = selectedDialogue.topicIDs.IndexOf(ct.id); topics[index].SetText(TextManager.GetText(ct.text.playerText)); topics[index].npcAnswer = TextManager.GetText(ct.text.NPCText); topics[index].SetIcon(ct.icon); topics[index].contractorTopic = ct; topics[index].topicType = typeof(ContractorTopic); topicIndex++; } } foreach (GovernmentTopic gt in ResourcesManager.Instance.govTopics) { if (selectedDialogue.topicIDs.Contains(gt.id)) { int index = selectedDialogue.topicIDs.IndexOf(gt.id); topics[index].SetText(TextManager.GetText(gt.texts.playerText)); topics[index].npcAnswer = TextManager.GetText(gt.texts.NPCText); topics[index].SetIcon(gt.icon); topics[index].govTopic = gt; topics[index].topicType = typeof(GovernmentTopic); topicIndex++; } } if (topicIndex == 1) { topics[1].gameObject.SetActive(false); } else if (topicIndex == 0) { foreach (NotepadTopic nt in topics) { nt.gameObject.SetActive(false); } } else { foreach (NotepadTopic nt in topics) { nt.gameObject.SetActive(true); } } StartCoroutine(DisplayCoroutine()); }
public void CloseNotePad() { foreach (NotepadTopic topic in topics) { topic.contractorTopic = null; topic.govTopic = null; topic.clickEnable = false; } _open = false; govSelected = null; contSelected = null; selectedDialogue = null; selectedNpc = null; activeDialogue = null; ControllerInput.RemoveScreen(transform); StartCoroutine(DisplayCoroutine()); Events.Instance.RemoveListener <OnActiveSelectTopic>(SelectTopic); }