Le quêtes sont désormais bien retirés quand choisis.
This commit is contained in:
parent
9f2e4c1063
commit
838f91ede7
7 changed files with 107 additions and 24 deletions
|
|
@ -83,6 +83,7 @@ namespace GameUI.Runtime
|
|||
QuestManager.Instance.NotifyAvailableQuestsUpdated(player.GuildLevel);
|
||||
|
||||
// Remove the accepted card from the board
|
||||
Info($"<color=green>Quest accepted?: {_quest.Name} : {_quest.State}</color>");
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,20 +65,49 @@ namespace GameUI.Runtime
|
|||
|
||||
void DisplayAvailableQuests(List<QuestTemplate> availableTemplates, List<QuestClass> acceptedQuests)
|
||||
{
|
||||
// Build a set of started quest IDs (Accepted/Active + Completed)
|
||||
// Build a set of started/accepted quest IDs to filter out from the board
|
||||
var startedIds = new HashSet<System.Guid>();
|
||||
// Active (in progress)
|
||||
foreach (var q in QuestManager.Instance.ActiveQuests ?? new List<QuestClass>())
|
||||
{
|
||||
if (q.ID != System.Guid.Empty) startedIds.Add(q.ID);
|
||||
if (q != null && q.ID != System.Guid.Empty) startedIds.Add(q.ID);
|
||||
}
|
||||
// Completed
|
||||
foreach (var q in QuestManager.Instance.CompletedQuests ?? new List<QuestClass>())
|
||||
{
|
||||
if (q.ID != System.Guid.Empty) startedIds.Add(q.ID);
|
||||
if (q != null && q.ID != System.Guid.Empty) startedIds.Add(q.ID);
|
||||
}
|
||||
// Accepted but not yet started (persisted list)
|
||||
try
|
||||
{
|
||||
if (FactExists<List<QuestClass>>("accepted_quests", out var accepted) && accepted != null)
|
||||
{
|
||||
foreach (var q in accepted)
|
||||
{
|
||||
if (q != null && q.ID != System.Guid.Empty) startedIds.Add(q.ID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try to read anyway (some implementations auto-initialize facts)
|
||||
var fallbackAccepted = GetFact<List<QuestClass>>("accepted_quests");
|
||||
if (fallbackAccepted != null)
|
||||
{
|
||||
foreach (var q in fallbackAccepted)
|
||||
{
|
||||
if (q != null && q.ID != System.Guid.Empty) startedIds.Add(q.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// If facts system isn't ready, just skip; board will refresh later
|
||||
}
|
||||
|
||||
foreach (var template in availableTemplates)
|
||||
{
|
||||
// Skip if this template already started (by GUID)
|
||||
// Skip if this template already started/accepted (by GUID)
|
||||
if (System.Guid.TryParse(template.m_assetGuid, out var guid) && startedIds.Contains(guid))
|
||||
{
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue