Compare commits
2 Commits
1ccc1d8796
...
0f942b0b77
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f942b0b77 | |||
| 111f68fa10 |
Binary file not shown.
Binary file not shown.
@ -10,5 +10,8 @@ InvalidTagCharacters="\"\',"
|
||||
+GameplayTagRedirects=(OldTagName="Skill.PoserPull",NewTagName="Skill.PowerPull")
|
||||
NumBitsForContainerSize=6
|
||||
NetIndexFirstBitSegment=16
|
||||
+GameplayTagList=(Tag="FishReward",DevComment="鱼获")
|
||||
+GameplayTagList=(Tag="FishReward.Fish1",DevComment="")
|
||||
+GameplayTagList=(Tag="FishReward.Fish2",DevComment="")
|
||||
+GameplayTagList=(Tag="Skill.PowerPull",DevComment="")
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -5,6 +5,7 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "ShapeAsset.h"
|
||||
#include "Engine/DataAsset.h"
|
||||
#include "ProjectFish/Quest/QuestTypes.h"
|
||||
#include "FishingRewardDataAsset.generated.h"
|
||||
|
||||
UENUM(BlueprintType)
|
||||
@ -36,4 +37,7 @@ public:
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Fishing Reward Data" , meta = (ToolTip = "鱼获稀有度"))
|
||||
ERewardRarityType RewardRarityType;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Fishing Reward Data" , meta = (ToolTip = "鱼获对应的任务信息"))
|
||||
FQuestTargetInfo QuestTargetInfo;
|
||||
};
|
||||
|
||||
@ -198,7 +198,7 @@ void UQuestManager::UpdateObjectiveProgress(int32 QuestID, int32 ObjectiveIndex,
|
||||
CheckQuestCompletion(QuestID);
|
||||
}
|
||||
|
||||
void UQuestManager::UpdateObjectiveByTargetID(FName TargetID, int32 ProgressDelta)
|
||||
void UQuestManager::UpdateObjectiveByTargetID(FGameplayTag TargetTag, int32 ProgressDelta)
|
||||
{
|
||||
// 遍历所有活动任务,查找匹配的目标
|
||||
for (TPair<int32, FQuestRuntimeData>& Pair : ActiveQuestsMap)
|
||||
@ -213,7 +213,7 @@ void UQuestManager::UpdateObjectiveByTargetID(FName TargetID, int32 ProgressDelt
|
||||
for (int32 i = 0; i < RuntimeData.QuestAsset->Objectives.Num(); ++i)
|
||||
{
|
||||
const FQuestObjective& Objective = RuntimeData.QuestAsset->Objectives[i];
|
||||
if (Objective.TargetID == TargetID)
|
||||
if (Objective.TargetID.TargetTag == TargetTag)
|
||||
{
|
||||
// 增加进度
|
||||
int32 NewProgress = RuntimeData.ObjectiveProgress[i].CurrentProgress + ProgressDelta;
|
||||
@ -257,6 +257,19 @@ TArray<UQuestAsset*> UQuestManager::GetActiveQuests() const
|
||||
return Result;
|
||||
}
|
||||
|
||||
TArray<UQuestAsset*> UQuestManager::GetFollowingQuests() const
|
||||
{
|
||||
TArray<UQuestAsset*> Result;
|
||||
for (const TPair<int32, FQuestRuntimeData>& Pair : ActiveQuestsMap)
|
||||
{
|
||||
if (FollowingQuestIDs.Contains(Pair.Key))
|
||||
{
|
||||
Result.Add(Pair.Value.QuestAsset);
|
||||
}
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
TArray<UQuestAsset*> UQuestManager::GetCompletedQuests() const
|
||||
{
|
||||
TArray<UQuestAsset*> Result;
|
||||
@ -281,6 +294,17 @@ bool UQuestManager::GetQuestProgress(int32 QuestID, TArray<FQuestProgress>& OutP
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UQuestManager::GetQuestRuntimeData(int32 QuestID, FQuestRuntimeData& OutData) const
|
||||
{
|
||||
const FQuestRuntimeData* RuntimeData = ActiveQuestsMap.Find(QuestID);
|
||||
if (RuntimeData)
|
||||
{
|
||||
OutData = *RuntimeData;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool UQuestManager::CanAcceptQuest(UQuestAsset* QuestAsset) const
|
||||
{
|
||||
if (!QuestAsset)
|
||||
@ -353,7 +377,7 @@ void UQuestManager::LoadFromSaveData(const TArray<FQuestSaveData>& SaveData)
|
||||
if (questAsset->QuestID == Data.QuestID)
|
||||
{
|
||||
FQuestRuntimeData RuntimeData = CreateRuntimeData(questAsset);
|
||||
for (int i =0; i < RuntimeData.ObjectiveProgress.Num(); i++)
|
||||
for (int i =0; i < Data.ObjectiveProgress.Num(); i++)
|
||||
{
|
||||
RuntimeData.ObjectiveProgress[i].CurrentProgress = Data.ObjectiveProgress[i];
|
||||
RuntimeData.ObjectiveProgress[i].bCompleted = Data.ObjectiveCompleted[i];
|
||||
|
||||
@ -79,7 +79,7 @@ public:
|
||||
|
||||
/** 通过目标ID更新进度(自动查找对应目标) */
|
||||
UFUNCTION(BlueprintCallable, Category = "Quest")
|
||||
void UpdateObjectiveByTargetID(FName TargetID, int32 ProgressDelta = 1);
|
||||
void UpdateObjectiveByTargetID(FGameplayTag TargetTag, int32 ProgressDelta = 1);
|
||||
|
||||
// ========== 任务查询 ==========
|
||||
|
||||
@ -95,6 +95,10 @@ public:
|
||||
UFUNCTION(BlueprintPure, Category = "Quest")
|
||||
TArray<UQuestAsset*> GetActiveQuests() const;
|
||||
|
||||
/** 获取所有追踪的任务 */
|
||||
UFUNCTION(BlueprintPure, Category = "Quest")
|
||||
TArray<UQuestAsset*> GetFollowingQuests() const;
|
||||
|
||||
/** 获取所有已完成的任务 */
|
||||
UFUNCTION(BlueprintPure, Category = "Quest")
|
||||
TArray<UQuestAsset*> GetCompletedQuests() const;
|
||||
@ -103,6 +107,10 @@ public:
|
||||
UFUNCTION(BlueprintPure, Category = "Quest")
|
||||
bool GetQuestProgress(int32 QuestID, TArray<FQuestProgress>& OutProgress) const;
|
||||
|
||||
/** 获取任务进度 */
|
||||
UFUNCTION(BlueprintPure, Category = "Quest")
|
||||
bool GetQuestRuntimeData(int32 QuestID, FQuestRuntimeData& OutData) const;
|
||||
|
||||
/** 检查是否可以接受任务(前置任务检查) */
|
||||
UFUNCTION(BlueprintPure, Category = "Quest")
|
||||
bool CanAcceptQuest(UQuestAsset* QuestAsset) const;
|
||||
@ -140,7 +148,7 @@ private:
|
||||
TMap<int32, FQuestRuntimeData> ActiveQuestsMap;
|
||||
|
||||
/** 正在追踪的任务列表 */
|
||||
UPROPERTY()
|
||||
UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess = true))
|
||||
TSet<int32> FollowingQuestIDs;
|
||||
|
||||
/** 已完成的任务ID列表 */
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "QuestTypes.generated.h"
|
||||
|
||||
/**
|
||||
@ -49,6 +50,24 @@ struct FQuestReward
|
||||
int32 GoldAmount = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* 任务目标数据
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FQuestTargetInfo
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/** 目标名称*/
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Quest")
|
||||
FText QuestTargetName;
|
||||
|
||||
/** 目标ID */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Quest")
|
||||
FGameplayTag TargetTag;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* 任务目标数据
|
||||
*/
|
||||
@ -67,7 +86,7 @@ struct FQuestObjective
|
||||
|
||||
/** 目标ID(物品ID、敌人ID、地点Tag等) */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Quest")
|
||||
FName TargetID;
|
||||
FQuestTargetInfo TargetID;
|
||||
|
||||
/** 需要完成的数量 */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Quest")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user