Skip to content

Commit cbc1ae0

Browse files
committed
Remove '<X>' string from questListUI
1 parent e055979 commit cbc1ae0

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

Assets/Scripts/Game/Quests/UI/QuestUI.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
using Game.NarrativeGenerator.Quests;
2+
using Game.Quests;
13
using System;
24
using System.Collections.Generic;
5+
using System.Text.RegularExpressions;
36
using UnityEngine;
4-
using UnityEngine.UIElements;
57
using UnityEngine.InputSystem;
6-
using Game.NarrativeGenerator.Quests;
7-
using Game.Quests;
8+
using UnityEngine.UIElements;
89

910
public class QuestUI : MonoBehaviour
1011
{
@@ -57,15 +58,24 @@ public void PopulateLabels()
5758
if (questLine.GetCurrentQuest() != null)
5859
{
5960
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());
6263
}
6364
foreach (var quest in questLine.GetCompletedQuests())
6465
{
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());
6768
}
6869
}
6970
_controller.PopulateLabels(questContents);
7071
}
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+
7181
}

0 commit comments

Comments
 (0)