Compare commits
2 Commits
0f942b0b77
...
c07849c95b
| Author | SHA1 | Date | |
|---|---|---|---|
| c07849c95b | |||
| 4821d206c0 |
BIN
ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish-0001.dll
Normal file
BIN
ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish-0001.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,7 +2,7 @@
|
||||
"BuildId": "37670630",
|
||||
"Modules":
|
||||
{
|
||||
"ProjectFish": "UnrealEditor-ProjectFish.dll",
|
||||
"ProjectFishEditor": "UnrealEditor-ProjectFishEditor.dll"
|
||||
"ProjectFish": "UnrealEditor-ProjectFish-0001.dll",
|
||||
"ProjectFishEditor": "UnrealEditor-ProjectFishEditor-0001.dll"
|
||||
}
|
||||
}
|
||||
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.
BIN
ProjectFish/Content/UI/Main/UMG_MainWindow.uasset
Normal file
BIN
ProjectFish/Content/UI/Main/UMG_MainWindow.uasset
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2,6 +2,6 @@
|
||||
"BuildId": "37670630",
|
||||
"Modules":
|
||||
{
|
||||
"DeskMode": "UnrealEditor-DeskMode.dll"
|
||||
"DeskMode": "UnrealEditor-DeskMode-0001.dll"
|
||||
}
|
||||
}
|
||||
@ -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<FAssetRegistryModule>("AssetRegistry");
|
||||
IAssetRegistry& AssetRegistry = AssetRegistryModule.Get();
|
||||
|
||||
// 查找所有 QuestAsset 资产
|
||||
TArray<FAssetData> AssetDataList;
|
||||
AssetRegistry.GetAssetsByClass(UQuestAsset::StaticClass()->GetClassPathName(), AssetDataList, true);
|
||||
|
||||
// 遍历所有已存在的任务资产,找到最大的 QuestID
|
||||
for (const FAssetData& AssetData : AssetDataList)
|
||||
{
|
||||
if (UQuestAsset* QuestAsset = Cast<UQuestAsset>(AssetData.GetAsset()))
|
||||
{
|
||||
if (QuestAsset->QuestID > MaxQuestID)
|
||||
{
|
||||
MaxQuestID = QuestAsset->QuestID;
|
||||
}
|
||||
}
|
||||
}
|
||||
QuestID += 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -17,6 +17,11 @@ void UGameInfoManager::Initialize(FSubsystemCollectionBase& Collection)
|
||||
}
|
||||
}
|
||||
|
||||
void UGameInfoManager::NewSaveGame()
|
||||
{
|
||||
UGameplayStatics::DeleteGameInSlot(SaveGameSlotName, 0);
|
||||
}
|
||||
|
||||
void UGameInfoManager::SaveGameInfo()
|
||||
{
|
||||
if (!IsValid(PlayerInfo.Get()))
|
||||
|
||||
@ -18,6 +18,8 @@ public:
|
||||
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void NewSaveGame();
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SaveGameInfo();
|
||||
UFUNCTION(BlueprintCallable)
|
||||
@ -30,5 +32,6 @@ public:
|
||||
protected:
|
||||
UPROPERTY(BlueprintReadOnly)
|
||||
TObjectPtr<class UPlayerInfoSaveGame> PlayerInfo;
|
||||
|
||||
static FString SaveGameSlotName;
|
||||
};
|
||||
|
||||
@ -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<UGameInfoManager>()->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<FQuestSaveData> UQuestManager::GetQuestSaveData() const
|
||||
{
|
||||
TArray<FQuestSaveData> SaveDataArray;
|
||||
|
||||
|
||||
for (const TPair<int32, FQuestRuntimeData>& Pair : ActiveQuestsMap)
|
||||
{
|
||||
FQuestSaveData SaveData;
|
||||
@ -352,6 +354,7 @@ TArray<FQuestSaveData> UQuestManager::GetQuestSaveData() const
|
||||
SaveDataArray.Add(SaveData);
|
||||
}
|
||||
|
||||
|
||||
return SaveDataArray;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user