// Moved from dialog UI. Needs to be done after a topic is selected, and it's text filtered before it is displayed. // Will eventually need to change teh color for detected topics, and somehow add clickable hyperlinks private string CheckForTopicsInText(string text) { // Loops through every available topic to see if it is contained in the text. foreach (var topic in topics) { // Add new topics to the journal and the list of available topics for this dialog. (Should trigger some kind of callback) // This currently does not remove the text from the string, but should so that other topics do not detect it. var index = text.IndexOf(topic.name, StringComparison.OrdinalIgnoreCase); if (index == -1) { continue; } // Should also make the text blue here // Make text blue() var hyperlinkText = "<color=#707ecfff>"; text = text.Insert(index, hyperlinkText); text = text.Insert(index + hyperlinkText.Length + topic.name.Length, "</color>"); // If the player already knows this topic, it will already be included, so we wouldn't need to check for it. // However we do need to check for it for hyperlinks sadly, so evenetually skip this check. // Maybe we could check for available topics for hyperlinks instead? if (player.Journal.Topics.ContainsKey(topic.name)) { continue; } // Add the topic to the journal player.Journal.AddTopic(topic.name, topic); dialogView.AddTopic(topic); } // The text may have had it's color modified, so return this return(text); }