diff --git a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll index d964049..9cc4474 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 d98d938..74517cf 100644 Binary files a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll and b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFishEditor.dll differ diff --git a/ProjectFish/Content/DataAssets/FishReward/Fish1Reward.uasset b/ProjectFish/Content/DataAssets/FishReward/Fish1Reward.uasset index a04395e..6597492 100644 Binary files a/ProjectFish/Content/DataAssets/FishReward/Fish1Reward.uasset and b/ProjectFish/Content/DataAssets/FishReward/Fish1Reward.uasset differ diff --git a/ProjectFish/Content/DataAssets/Quest/Quest2_TriggerByQuest1.uasset b/ProjectFish/Content/DataAssets/Quest/Quest2_TriggerByQuest1.uasset index 223988c..f152d8c 100644 Binary files a/ProjectFish/Content/DataAssets/Quest/Quest2_TriggerByQuest1.uasset and b/ProjectFish/Content/DataAssets/Quest/Quest2_TriggerByQuest1.uasset differ diff --git a/ProjectFish/Content/DataAssets/Quest/Quest3_CompleteByTargetPos.uasset b/ProjectFish/Content/DataAssets/Quest/Quest3_CompleteByTargetPos.uasset index 3b36f43..d489d0d 100644 Binary files a/ProjectFish/Content/DataAssets/Quest/Quest3_CompleteByTargetPos.uasset and b/ProjectFish/Content/DataAssets/Quest/Quest3_CompleteByTargetPos.uasset differ diff --git a/ProjectFish/Content/DataAssets/Quest/Quest4_CompleteByEnemy.uasset b/ProjectFish/Content/DataAssets/Quest/Quest4_CompleteByEnemy.uasset index 1365e90..f393b69 100644 Binary files a/ProjectFish/Content/DataAssets/Quest/Quest4_CompleteByEnemy.uasset and b/ProjectFish/Content/DataAssets/Quest/Quest4_CompleteByEnemy.uasset differ diff --git a/ProjectFish/Content/UI/Fishing/Widgets/FollowQuest/UMG_Following_Quest_Item.uasset b/ProjectFish/Content/UI/Fishing/Widgets/FollowQuest/UMG_Following_Quest_Item.uasset index 85347d9..80e463a 100644 Binary files a/ProjectFish/Content/UI/Fishing/Widgets/FollowQuest/UMG_Following_Quest_Item.uasset and b/ProjectFish/Content/UI/Fishing/Widgets/FollowQuest/UMG_Following_Quest_Item.uasset differ diff --git a/ProjectFish/Content/UI/Fishing/Widgets/FollowQuest/UMG_Following_Quest_ObjectInfo.uasset b/ProjectFish/Content/UI/Fishing/Widgets/FollowQuest/UMG_Following_Quest_ObjectInfo.uasset index 92751c0..0842e0f 100644 Binary files a/ProjectFish/Content/UI/Fishing/Widgets/FollowQuest/UMG_Following_Quest_ObjectInfo.uasset and b/ProjectFish/Content/UI/Fishing/Widgets/FollowQuest/UMG_Following_Quest_ObjectInfo.uasset differ diff --git a/ProjectFish/Content/UI/Fishing/Windows/UMG_FishingRewardSelect_Window.uasset b/ProjectFish/Content/UI/Fishing/Windows/UMG_FishingRewardSelect_Window.uasset index 878bac7..bcf8fc9 100644 Binary files a/ProjectFish/Content/UI/Fishing/Windows/UMG_FishingRewardSelect_Window.uasset and b/ProjectFish/Content/UI/Fishing/Windows/UMG_FishingRewardSelect_Window.uasset differ diff --git a/ProjectFish/Content/UI/HomeUI/Windows/UMG_HomeWindow_PlayerContainer.uasset b/ProjectFish/Content/UI/HomeUI/Windows/UMG_HomeWindow_PlayerContainer.uasset index 5626a37..ac7e28a 100644 Binary files a/ProjectFish/Content/UI/HomeUI/Windows/UMG_HomeWindow_PlayerContainer.uasset and b/ProjectFish/Content/UI/HomeUI/Windows/UMG_HomeWindow_PlayerContainer.uasset differ diff --git a/ProjectFish/Content/UI/Quest/Widget/UMG_QuestInfo_Widget.uasset b/ProjectFish/Content/UI/Quest/Widget/UMG_QuestInfo_Widget.uasset index b7deede..024dcfc 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/Content/UI/Quest/Window/UMG_QuestWindow.uasset b/ProjectFish/Content/UI/Quest/Window/UMG_QuestWindow.uasset index 2b9c6e9..386e7af 100644 Binary files a/ProjectFish/Content/UI/Quest/Window/UMG_QuestWindow.uasset and b/ProjectFish/Content/UI/Quest/Window/UMG_QuestWindow.uasset differ diff --git a/ProjectFish/Source/ProjectFish/DataAsset/QuestAsset.cpp b/ProjectFish/Source/ProjectFish/DataAsset/QuestAsset.cpp index 562914c..d27f6d8 100644 --- a/ProjectFish/Source/ProjectFish/DataAsset/QuestAsset.cpp +++ b/ProjectFish/Source/ProjectFish/DataAsset/QuestAsset.cpp @@ -54,5 +54,35 @@ void UQuestAsset::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedE } } } + +void UQuestAsset::PostDuplicate(bool bDuplicateForPIE) +{ + Super::PostDuplicate(bDuplicateForPIE); + if (!bDuplicateForPIE) + { + int32 MaxQuestID = 0; + + // 获取资产注册表模块 + FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked("AssetRegistry"); + IAssetRegistry& AssetRegistry = AssetRegistryModule.Get(); + + // 查找所有 QuestAsset 资产 + TArray AssetDataList; + AssetRegistry.GetAssetsByClass(UQuestAsset::StaticClass()->GetClassPathName(), AssetDataList, true); + + // 遍历所有已存在的任务资产,找到最大的 QuestID + for (const FAssetData& AssetData : AssetDataList) + { + if (UQuestAsset* QuestAsset = Cast(AssetData.GetAsset())) + { + if (QuestAsset->QuestID > MaxQuestID) + { + MaxQuestID = QuestAsset->QuestID; + } + } + } + QuestID += 1; + } +} #endif diff --git a/ProjectFish/Source/ProjectFish/DataAsset/QuestAsset.h b/ProjectFish/Source/ProjectFish/DataAsset/QuestAsset.h index c352c5d..a4bdc56 100644 --- a/ProjectFish/Source/ProjectFish/DataAsset/QuestAsset.h +++ b/ProjectFish/Source/ProjectFish/DataAsset/QuestAsset.h @@ -20,6 +20,8 @@ public: #if WITH_EDITOR // 编辑器中属性修改后的回调 virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override; + + virtual void PostDuplicate(bool bDuplicateForPIE) override; #endif /** 任务编号ID */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Quest|Basic") diff --git a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/QuestManager.cpp b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/QuestManager.cpp index 7d4fcbe..8ef0679 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/QuestManager.cpp +++ b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/QuestManager.cpp @@ -140,13 +140,12 @@ bool UQuestManager::CompleteQuest(int32 QuestID) // 触发事件 OnQuestStateChanged.Broadcast(QuestID); UE_LOG(LogTemp, Warning, TEXT("Quest id = %d Complete"), QuestID); - // 从活动任务中移除 - ActiveQuestsMap.Remove(QuestID); + // // 从活动任务中移除 + // ActiveQuestsMap.Remove(QuestID); //更新存档数据 GetGameInstance()->GetSubsystem()->SaveGameInfo(); - //检测是否有其他可接受的任务 - CheckAcceptableQuests(); + return true; } @@ -221,6 +220,9 @@ void UQuestManager::UpdateObjectiveByTargetID(FGameplayTag TargetTag, int32 Prog } } } + + //检测是否有其他可接受的任务 + CheckAcceptableQuests(); } EQuestState UQuestManager::GetQuestState(int32 QuestID) const @@ -327,7 +329,7 @@ bool UQuestManager::CanAcceptQuest(UQuestAsset* QuestAsset) const TArray UQuestManager::GetQuestSaveData() const { TArray SaveDataArray; - + for (const TPair& Pair : ActiveQuestsMap) { FQuestSaveData SaveData; @@ -352,6 +354,7 @@ TArray UQuestManager::GetQuestSaveData() const SaveDataArray.Add(SaveData); } + return SaveDataArray; }