|
| 1 | +using Game.NarrativeGenerator.Quests; |
| 2 | +using Game.Quests; |
1 | 3 | using System; |
2 | 4 | using System.Collections.Generic; |
| 5 | +using System.Text.RegularExpressions; |
3 | 6 | using UnityEngine; |
4 | | -using UnityEngine.UIElements; |
5 | 7 | using UnityEngine.InputSystem; |
6 | | -using Game.NarrativeGenerator.Quests; |
7 | | -using Game.Quests; |
| 8 | +using UnityEngine.UIElements; |
8 | 9 |
|
9 | 10 | public class QuestUI : MonoBehaviour |
10 | 11 | { |
@@ -57,15 +58,24 @@ public void PopulateLabels() |
57 | 58 | if (questLine.GetCurrentQuest() != null) |
58 | 59 | { |
59 | 60 | questLine.GetCurrentQuest().CreateQuestString(); |
60 | | - //questContents[0] += "\n - "+questLine.GetCurrentQuest().GetType().Name.Replace("QuestSo", "")+" "+questLine.GetCurrentQuest().ToString(); |
61 | | - questContents[0] += "\n - " + " " + questLine.GetCurrentQuest().ToString(); |
| 61 | + //questContents[0] += "\n - "+questLine.GetCurrentQuest().GetType().Name.Replace("QuestSo", "") + " " + RemoveAngleBracketContent(questLine.GetCurrentQuest().ToString()); |
| 62 | + questContents[0] += "\n - " + " " + RemoveAngleBracketContent(questLine.GetCurrentQuest().ToString()); |
62 | 63 | } |
63 | 64 | foreach (var quest in questLine.GetCompletedQuests()) |
64 | 65 | { |
65 | | - //questContents[1] += "\n - "+quest.GetType().Name.Replace("QuestSo", "")+" "+quest.ToString(); |
66 | | - questContents[1] += "\n - " + " " + quest.ToString(); |
| 66 | + //questContents[1] += "\n - "+quest.GetType().Name.Replace("QuestSo", "") + " " + RemoveAngleBracketContent(quest.ToString()); |
| 67 | + questContents[1] += "\n - " + " " + RemoveAngleBracketContent(quest.ToString()); |
67 | 68 | } |
68 | 69 | } |
69 | 70 | _controller.PopulateLabels(questContents); |
70 | 71 | } |
| 72 | + private string RemoveAngleBracketContent(string input) |
| 73 | + { |
| 74 | + if (string.IsNullOrEmpty(input)) |
| 75 | + return input; |
| 76 | + |
| 77 | + // Regex: "<[^>]*>" matches "<" followed by any number of non-">" chars, ending with ">" |
| 78 | + return System.Text.RegularExpressions.Regex.Replace(input, "<[^>]*>", string.Empty).Trim(); |
| 79 | + } |
| 80 | + |
71 | 81 | } |
0 commit comments