diff --git a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll index f2bf645..5b9586b 100644 Binary files a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll and b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll differ diff --git a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll index f973998..7bf96f6 100644 Binary files a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll and b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll differ diff --git a/ProjectFish/Content/UI/Quest/Widget/UMG_QuestInfo_Widget.uasset b/ProjectFish/Content/UI/Quest/Widget/UMG_QuestInfo_Widget.uasset index 4dfd8a5..b7deede 100644 Binary files a/ProjectFish/Content/UI/Quest/Widget/UMG_QuestInfo_Widget.uasset and b/ProjectFish/Content/UI/Quest/Widget/UMG_QuestInfo_Widget.uasset differ diff --git a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/QuestManager.cpp b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/QuestManager.cpp index efbd19c..956dd1e 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/QuestManager.cpp +++ b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/QuestManager.cpp @@ -86,6 +86,25 @@ bool UQuestManager::AcceptQuest(UQuestAsset* QuestAsset) return true; } +bool UQuestManager::FollowQuest(int32 QuestID, bool Follow) +{ + FQuestRuntimeData* RuntimeData = ActiveQuestsMap.Find(QuestID); + if (!RuntimeData) + { + return false; + } + + if (Follow) + { + FollowingQuestIDs.Add(QuestID); + } + else + { + FollowingQuestIDs.Remove(QuestID); + } + return true; +} + bool UQuestManager::CompleteQuest(int32 QuestID) { FQuestRuntimeData* RuntimeData = ActiveQuestsMap.Find(QuestID); @@ -206,6 +225,11 @@ EQuestState UQuestManager::GetQuestState(int32 QuestID) const return EQuestState::NotStarted; } +bool UQuestManager::IsQuestFollowing(int32 QuestID) const +{ + return FollowingQuestIDs.Contains(QuestID); +} + TArray UQuestManager::GetActiveQuests() const { TArray Result; @@ -278,7 +302,15 @@ TArray UQuestManager::GetQuestSaveData() const SaveData.ObjectiveProgress.Add(Progress.CurrentProgress); SaveData.ObjectiveCompleted.Add(Progress.bCompleted); } - + //设置追踪状态 + if (FollowingQuestIDs.Contains(Pair.Key)) + { + SaveData.bFollowing = true; + } + else + { + SaveData.bFollowing = false; + } SaveDataArray.Add(SaveData); } @@ -290,6 +322,8 @@ void UQuestManager::LoadFromSaveData(const TArray& SaveData) // 清空现有数据 ActiveQuestsMap.Empty(); CompletedQuestIDs.Empty(); + FollowingQuestIDs.Empty(); + LoadAllQuests(); for (const FQuestSaveData& Data : SaveData) @@ -313,7 +347,11 @@ void UQuestManager::LoadFromSaveData(const TArray& SaveData) RuntimeData.State = EQuestState::InProgress; ActiveQuestsMap.Add(questAsset->QuestID, RuntimeData); - + //添加追踪任务列表 + if (Data.bFollowing) + { + FollowingQuestIDs.Add(questAsset->QuestID); + } return; } } diff --git a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/QuestManager.h b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/QuestManager.h index 28e0da6..2e272c6 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/QuestManager.h +++ b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/QuestManager.h @@ -59,6 +59,10 @@ public: UFUNCTION(BlueprintCallable, Category = "Quest") bool AcceptQuest(UQuestAsset* QuestAsset); + /** 接受任务 */ + UFUNCTION(BlueprintCallable, Category = "Quest") + bool FollowQuest(int32 QuestID, bool Follow); + /** 完成任务 */ UFUNCTION(BlueprintCallable, Category = "Quest") bool CompleteQuest(int32 QuestID); @@ -83,6 +87,10 @@ public: UFUNCTION(BlueprintPure, Category = "Quest") EQuestState GetQuestState(int32 QuestID) const; + /** 任务是否正在被追踪 */ + UFUNCTION(BlueprintPure, Category = "Quest") + bool IsQuestFollowing(int32 QuestID) const; + /** 获取所有进行中的任务 */ UFUNCTION(BlueprintPure, Category = "Quest") TArray GetActiveQuests() const; @@ -131,6 +139,10 @@ private: UPROPERTY() TMap ActiveQuestsMap; + /** 正在追踪的任务列表 */ + UPROPERTY() + TSet FollowingQuestIDs; + /** 已完成的任务ID列表 */ UPROPERTY() TSet CompletedQuestIDs; diff --git a/ProjectFish/Source/ProjectFish/Quest/QuestTypes.h b/ProjectFish/Source/ProjectFish/Quest/QuestTypes.h index 0fdb274..0eef92b 100644 --- a/ProjectFish/Source/ProjectFish/Quest/QuestTypes.h +++ b/ProjectFish/Source/ProjectFish/Quest/QuestTypes.h @@ -103,6 +103,10 @@ struct FQuestSaveData UPROPERTY(SaveGame, BlueprintReadWrite) int32 QuestID = 0; + /** 是否正在追踪 */ + UPROPERTY(SaveGame, BlueprintReadWrite) + bool bFollowing = false; + /** 任务状态 */ UPROPERTY(SaveGame, BlueprintReadWrite) EQuestState QuestState = EQuestState::NotStarted;