// Get the next chat node and update the chat banner accordingly static void NextBanner() { // Save the NodeType of the next chat node Dialog.NodeType next = chatting.Next(); // Update the text region and icon SetTextRegion(next); SetIcon(next); // If the nodetype is a Page, simply display the text if (next == Dialog.NodeType.Page || next == Dialog.NodeType.Say) { PlayString(chatting.page); // If it's a Reply, populate the banner with the available responses } else if (next == Dialog.NodeType.Reply) { displayedOptions = Vector2.up * (chatting.options.Count - 1); pageRanges.Clear(); currentlySelected = 0; UpdateResponse(0); // If the type is Finish, terminate the chat session and hide the banner } else if (next == Dialog.NodeType.Finish) { HideBanner(); } }
// Update the current icon depending on the current node type static void SetIcon(Dialog.NodeType type) { if (type == Dialog.NodeType.Finish) { return; } ChatManager cm = GetCM(); cm.playerHead.gameObject.SetActive(false); cm.npcHead.gameObject.SetActive(false); cm.npcName.gameObject.SetActive(false); if (type == Dialog.NodeType.Page) { cm.npcHead.gameObject.SetActive(true); cm.npcName.gameObject.SetActive(true); } else if (type == Dialog.NodeType.Reply || type == Dialog.NodeType.Say) { cm.playerHead.gameObject.SetActive(true); } }
// Update the current text region depending on the current node type static void SetTextRegion(Dialog.NodeType type) { if (type == Dialog.NodeType.Finish) { return; } ChatManager cm = GetCM(); cm.npcRegion.gameObject.SetActive(false); cm.playerRegion.gameObject.SetActive(false); switch (type) { case Dialog.NodeType.Say: case Dialog.NodeType.Reply: cm.playerRegion.gameObject.SetActive(true); currentRegion = cm.playerRegion; break; case Dialog.NodeType.Page: cm.npcRegion.gameObject.SetActive(true); currentRegion = cm.npcRegion; break; } }