For anyone else trying to achieve something like this I was able to do it like this (in QuestListUI.cs):
private void ReDraw()
{
List<QuestStatus> completeQuests = new List<QuestStatus>();
List<QuestStatus> incompleteQuests = new List<QuestStatus>();
// Separate quests based on their completion status
foreach (QuestStatus status in questList.GetStatuses())
{
if (status.IsComplete())
{
completeQuests.Add(status);
}
else
{
incompleteQuests.Add(status);
}
}
// Destroy all current UI items
foreach (Transform item in transform)
{
Destroy(item.gameObject);
}
// Instantiate UI items for incomplete quests first
foreach (QuestStatus status in incompleteQuests)
{
InstantiateQuestItem(status);
}
// Instantiate UI items for complete quests with strikethrough
foreach (QuestStatus status in completeQuests)
{
InstantiateQuestItem(status);
}
}
private void InstantiateQuestItem(QuestStatus status)
{
QuestItemUI uiInstance = Instantiate<QuestItemUI>(questPrefab, transform);
// Check if the quest is complete, and if so, apply strikethrough effect to title
if (status.IsComplete())
{
uiInstance.SetTitleText($"<s>{status.GetQuest().GetTitle()}</s>"); // Wrap the title in <s> tags
}
else
{
uiInstance.SetTitleText(status.GetQuest().GetTitle()); // Set title without strikethrough
}
uiInstance.Setup(status);
}