diff --git a/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll b/ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.dll index ef58065..b459e50 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 aab4c08..02c5af5 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/Dialogue/Dialogue_Click_MarketQuest.uasset b/ProjectFish/Content/DataAssets/Dialogue/Dialogue_Click_MarketQuest.uasset new file mode 100644 index 0000000..ab56b99 Binary files /dev/null and b/ProjectFish/Content/DataAssets/Dialogue/Dialogue_Click_MarketQuest.uasset differ diff --git a/ProjectFish/Content/DataAssets/Dialogue/Dialogue_ReadyMarket.uasset b/ProjectFish/Content/DataAssets/Dialogue/Dialogue_ReadyMarket.uasset index 6fa319a..39cc794 100644 Binary files a/ProjectFish/Content/DataAssets/Dialogue/Dialogue_ReadyMarket.uasset and b/ProjectFish/Content/DataAssets/Dialogue/Dialogue_ReadyMarket.uasset differ diff --git a/ProjectFish/Content/DataAssets/Dialogue/Dialogue_Tutorial_Final.uasset b/ProjectFish/Content/DataAssets/Dialogue/Dialogue_Tutorial_Final.uasset new file mode 100644 index 0000000..347b837 Binary files /dev/null and b/ProjectFish/Content/DataAssets/Dialogue/Dialogue_Tutorial_Final.uasset differ diff --git a/ProjectFish/Content/DataAssets/Dialogue/Dialogue_Tutorial_Returnback.uasset b/ProjectFish/Content/DataAssets/Dialogue/Dialogue_Tutorial_Returnback.uasset new file mode 100644 index 0000000..3bb7990 Binary files /dev/null and b/ProjectFish/Content/DataAssets/Dialogue/Dialogue_Tutorial_Returnback.uasset differ diff --git a/ProjectFish/Content/DataAssets/Fish/Fish_Boss.uasset b/ProjectFish/Content/DataAssets/Fish/Fish_Boss.uasset index 3e141d3..31cebeb 100644 Binary files a/ProjectFish/Content/DataAssets/Fish/Fish_Boss.uasset and b/ProjectFish/Content/DataAssets/Fish/Fish_Boss.uasset differ diff --git a/ProjectFish/Content/DataAssets/FishReward/Reward_MagicBook.uasset b/ProjectFish/Content/DataAssets/FishReward/Reward_MagicBook.uasset index af665e3..54d92a7 100644 Binary files a/ProjectFish/Content/DataAssets/FishReward/Reward_MagicBook.uasset and b/ProjectFish/Content/DataAssets/FishReward/Reward_MagicBook.uasset differ diff --git a/ProjectFish/Content/DataAssets/FishReward/Shapes/Shape_2x2.uasset b/ProjectFish/Content/DataAssets/FishReward/Shapes/Shape_2x2.uasset new file mode 100644 index 0000000..9bcabf9 Binary files /dev/null and b/ProjectFish/Content/DataAssets/FishReward/Shapes/Shape_2x2.uasset differ diff --git a/ProjectFish/Content/DataAssets/Quest/Quest1_AutoAccept_CompleteByReward.uasset b/ProjectFish/Content/DataAssets/Quest/Quest1_AutoAccept_CompleteByReward.uasset deleted file mode 100644 index 14a7f74..0000000 Binary files a/ProjectFish/Content/DataAssets/Quest/Quest1_AutoAccept_CompleteByReward.uasset and /dev/null differ diff --git a/ProjectFish/Content/DataAssets/Quest/Quest2_TriggerByQuest1.uasset b/ProjectFish/Content/DataAssets/Quest/Quest2_TriggerByQuest1.uasset deleted file mode 100644 index cc2f32e..0000000 Binary files a/ProjectFish/Content/DataAssets/Quest/Quest2_TriggerByQuest1.uasset and /dev/null differ diff --git a/ProjectFish/Content/DataAssets/Quest/Quest3_CompleteByTargetPos.uasset b/ProjectFish/Content/DataAssets/Quest/Quest3_CompleteByTargetPos.uasset deleted file mode 100644 index f7cee21..0000000 Binary files a/ProjectFish/Content/DataAssets/Quest/Quest3_CompleteByTargetPos.uasset and /dev/null differ diff --git a/ProjectFish/Content/DataAssets/Quest/Quest4_CompleteByEnemy.uasset b/ProjectFish/Content/DataAssets/Quest/Quest4_CompleteByEnemy.uasset deleted file mode 100644 index caa9c5e..0000000 Binary files a/ProjectFish/Content/DataAssets/Quest/Quest4_CompleteByEnemy.uasset and /dev/null differ diff --git a/ProjectFish/Content/DataAssets/Quest/Quest_Main_Witch.uasset b/ProjectFish/Content/DataAssets/Quest/Quest_Main_Witch.uasset new file mode 100644 index 0000000..c13eefa Binary files /dev/null and b/ProjectFish/Content/DataAssets/Quest/Quest_Main_Witch.uasset differ diff --git a/ProjectFish/Content/DataAssets/Quest/TestQuest2_TriggerByQuest1.uasset b/ProjectFish/Content/DataAssets/Quest/TestQuest2_TriggerByQuest1.uasset new file mode 100644 index 0000000..20a833b Binary files /dev/null and b/ProjectFish/Content/DataAssets/Quest/TestQuest2_TriggerByQuest1.uasset differ diff --git a/ProjectFish/Content/DataAssets/Quest/TestQuest3_CompleteByTargetPos.uasset b/ProjectFish/Content/DataAssets/Quest/TestQuest3_CompleteByTargetPos.uasset new file mode 100644 index 0000000..03875b2 Binary files /dev/null and b/ProjectFish/Content/DataAssets/Quest/TestQuest3_CompleteByTargetPos.uasset differ diff --git a/ProjectFish/Content/DataAssets/Quest/TestQuest4_CompleteByEnemy.uasset b/ProjectFish/Content/DataAssets/Quest/TestQuest4_CompleteByEnemy.uasset new file mode 100644 index 0000000..1e7fd08 Binary files /dev/null and b/ProjectFish/Content/DataAssets/Quest/TestQuest4_CompleteByEnemy.uasset differ diff --git a/ProjectFish/Content/DataTable/DT_MarketQuestDialogue.uasset b/ProjectFish/Content/DataTable/DT_MarketQuestDialogue.uasset index 650a14f..e0c199c 100644 Binary files a/ProjectFish/Content/DataTable/DT_MarketQuestDialogue.uasset and b/ProjectFish/Content/DataTable/DT_MarketQuestDialogue.uasset differ diff --git a/ProjectFish/Content/DataTable/DT_TutorialSteps.uasset b/ProjectFish/Content/DataTable/DT_TutorialSteps.uasset index 68b0e74..c1670f1 100644 Binary files a/ProjectFish/Content/DataTable/DT_TutorialSteps.uasset and b/ProjectFish/Content/DataTable/DT_TutorialSteps.uasset differ diff --git a/ProjectFish/Content/Gameplay/BP_FishGameInstance.uasset b/ProjectFish/Content/Gameplay/BP_FishGameInstance.uasset index b42fba6..0d17d6d 100644 Binary files a/ProjectFish/Content/Gameplay/BP_FishGameInstance.uasset and b/ProjectFish/Content/Gameplay/BP_FishGameInstance.uasset differ diff --git a/ProjectFish/Content/Gameplay/Home/BP_HomePlayerController.uasset b/ProjectFish/Content/Gameplay/Home/BP_HomePlayerController.uasset index df16bac..02687f7 100644 Binary files a/ProjectFish/Content/Gameplay/Home/BP_HomePlayerController.uasset and b/ProjectFish/Content/Gameplay/Home/BP_HomePlayerController.uasset differ diff --git a/ProjectFish/Content/Gameplay/Ship/BP_ShipController.uasset b/ProjectFish/Content/Gameplay/Ship/BP_ShipController.uasset index d8bb37f..f6c0a51 100644 Binary files a/ProjectFish/Content/Gameplay/Ship/BP_ShipController.uasset and b/ProjectFish/Content/Gameplay/Ship/BP_ShipController.uasset differ diff --git a/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_ConfigFish.uasset b/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_ConfigFish.uasset index 8ccf35d..48074e3 100644 Binary files a/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_ConfigFish.uasset and b/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_ConfigFish.uasset differ diff --git a/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_ConfigFish1.uasset b/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_ConfigFish1.uasset new file mode 100644 index 0000000..d0aa121 Binary files /dev/null and b/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_ConfigFish1.uasset differ diff --git a/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_Delay.uasset b/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_Delay.uasset new file mode 100644 index 0000000..24947ee Binary files /dev/null and b/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_Delay.uasset differ diff --git a/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_ShipItems_1.uasset b/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_ShipItems_1.uasset new file mode 100644 index 0000000..de4428b Binary files /dev/null and b/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_ShipItems_1.uasset differ diff --git a/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_ShipItems_3.uasset b/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_ShipItems_3.uasset new file mode 100644 index 0000000..9c78edb Binary files /dev/null and b/ProjectFish/Content/Gameplay/TutorialSystem/TutorialTask_ShipItems_3.uasset differ diff --git a/ProjectFish/Content/UI/Fishing/Widgets/Select/UMG_FishingReward_SelectWidget.uasset b/ProjectFish/Content/UI/Fishing/Widgets/Select/UMG_FishingReward_SelectWidget.uasset index a0dd531..2594d28 100644 Binary files a/ProjectFish/Content/UI/Fishing/Widgets/Select/UMG_FishingReward_SelectWidget.uasset and b/ProjectFish/Content/UI/Fishing/Widgets/Select/UMG_FishingReward_SelectWidget.uasset differ diff --git a/ProjectFish/Content/UI/Fishing/Windows/UMG_ManagerFishingREward_Window.uasset b/ProjectFish/Content/UI/Fishing/Windows/UMG_ManagerFishingREward_Window.uasset index 067e326..d91d6e9 100644 Binary files a/ProjectFish/Content/UI/Fishing/Windows/UMG_ManagerFishingREward_Window.uasset and b/ProjectFish/Content/UI/Fishing/Windows/UMG_ManagerFishingREward_Window.uasset differ diff --git a/ProjectFish/Content/UI/Fishing/Windows/UMG_ReadyWIndow.uasset b/ProjectFish/Content/UI/Fishing/Windows/UMG_ReadyWIndow.uasset index 90bfa29..3b28ddb 100644 Binary files a/ProjectFish/Content/UI/Fishing/Windows/UMG_ReadyWIndow.uasset and b/ProjectFish/Content/UI/Fishing/Windows/UMG_ReadyWIndow.uasset differ diff --git a/ProjectFish/Content/UI/HomeUI/Widgets/HomeFuncList/UMG_Home_FuncList.uasset b/ProjectFish/Content/UI/HomeUI/Widgets/HomeFuncList/UMG_Home_FuncList.uasset index 3ecb9a7..244f6db 100644 Binary files a/ProjectFish/Content/UI/HomeUI/Widgets/HomeFuncList/UMG_Home_FuncList.uasset and b/ProjectFish/Content/UI/HomeUI/Widgets/HomeFuncList/UMG_Home_FuncList.uasset differ diff --git a/ProjectFish/Content/UI/Market/Window/UMG_Market_Dialogue.uasset b/ProjectFish/Content/UI/Market/Window/UMG_Market_Dialogue.uasset index bee20de..861734a 100644 Binary files a/ProjectFish/Content/UI/Market/Window/UMG_Market_Dialogue.uasset and b/ProjectFish/Content/UI/Market/Window/UMG_Market_Dialogue.uasset differ diff --git a/ProjectFish/Content/UI/Market/Window/UMG_Market_Quest.uasset b/ProjectFish/Content/UI/Market/Window/UMG_Market_Quest.uasset index e728237..403deba 100644 Binary files a/ProjectFish/Content/UI/Market/Window/UMG_Market_Quest.uasset and b/ProjectFish/Content/UI/Market/Window/UMG_Market_Quest.uasset differ diff --git a/ProjectFish/Source/ProjectFish/Data/ContainerInfo.cpp b/ProjectFish/Source/ProjectFish/Data/ContainerInfo.cpp index 2de4af8..3f160c8 100644 --- a/ProjectFish/Source/ProjectFish/Data/ContainerInfo.cpp +++ b/ProjectFish/Source/ProjectFish/Data/ContainerInfo.cpp @@ -84,8 +84,8 @@ TSet UContainerInfo::GetOverlapOtherItem(FContainerItem Item) if (Item.IsSlotUsing(FIntPoint(x, y))) { - if (ContainerShape->IsSlotActive(Item.ContainerStartPos.X + x, Item.ContainerStartPos.Y + y) && - SlotItems[FIntPoint(x + Item.ContainerStartPos.X, y + Item.ContainerStartPos.Y)] != -1 + if (ContainerShape->IsSlotActive(Item.ContainerStartPos.X + x, Item.ContainerStartPos.Y + y) && SlotItems.Contains(FIntPoint(x + Item.ContainerStartPos.X, y + Item.ContainerStartPos.Y)) + ///SlotItems[FIntPoint(x + Item.ContainerStartPos.X, y + Item.ContainerStartPos.Y)] != -1 ) { OverlapItems.Add(SlotItems[FIntPoint(x + Item.ContainerStartPos.X, y + Item.ContainerStartPos.Y)] ); diff --git a/ProjectFish/Source/ProjectFish/Data/PlayerInfoSaveGame.cpp b/ProjectFish/Source/ProjectFish/Data/PlayerInfoSaveGame.cpp index a6cba9e..98ab076 100644 --- a/ProjectFish/Source/ProjectFish/Data/PlayerInfoSaveGame.cpp +++ b/ProjectFish/Source/ProjectFish/Data/PlayerInfoSaveGame.cpp @@ -5,12 +5,18 @@ #include "ProjectFish/Gameplay/Subsystem/GameInfoManager.h" +void UPlayerInfoSaveGame::BeginDestroy() +{ + Super::BeginDestroy(); +} + void UPlayerInfoSaveGame::SetShipContainerItems(TArray NewItems) { ShipContainerItems = NewItems; - if (GetWorld()) + + if (GetOuter()) { - GetWorld()->GetGameInstance()->GetSubsystem()->SaveGameInfo(); + GetOuter()->GetWorld()->GetGameInstance()->GetSubsystem()->SaveGameInfo(); OnShipContainerUpdate.Broadcast(); } } diff --git a/ProjectFish/Source/ProjectFish/Data/PlayerInfoSaveGame.h b/ProjectFish/Source/ProjectFish/Data/PlayerInfoSaveGame.h index 93d5b57..7ee9f24 100644 --- a/ProjectFish/Source/ProjectFish/Data/PlayerInfoSaveGame.h +++ b/ProjectFish/Source/ProjectFish/Data/PlayerInfoSaveGame.h @@ -18,6 +18,8 @@ class PROJECTFISH_API UPlayerInfoSaveGame : public USaveGame { GENERATED_BODY() public: + + virtual void BeginDestroy() override; UPROPERTY(SaveGame, BlueprintReadWrite, meta = (ToolTip = "开启教程模式")) bool TutorialMode = true; @@ -57,10 +59,11 @@ public: UPROPERTY(SaveGame, BlueprintReadWrite, meta = (ToolTip = "被击败的鱼")) TArray Fish_defeated_IDS; -protected: +public: UPROPERTY(BlueprintAssignable, Category = "PlayerInfoSaveGame") FOnShipContainerUpdate OnShipContainerUpdate; +protected: UFUNCTION(BlueprintCallable, Category= "PlayerInfoSaveGame") void SetShipContainerItems(TArray NewItems); }; diff --git a/ProjectFish/Source/ProjectFish/Gameplay/FishGameInstance.h b/ProjectFish/Source/ProjectFish/Gameplay/FishGameInstance.h index 446e4de..79d5bcd 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/FishGameInstance.h +++ b/ProjectFish/Source/ProjectFish/Gameplay/FishGameInstance.h @@ -16,7 +16,7 @@ class PROJECTFISH_API UFishGameInstance : public UGameInstance public: /** GameInstace */ virtual void OnStart() override; - + UFUNCTION(BlueprintImplementableEvent) void InitTutorialSteps(); }; diff --git a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/GameInfoManager.cpp b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/GameInfoManager.cpp index afcd48d..43378ea 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/GameInfoManager.cpp +++ b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/GameInfoManager.cpp @@ -24,9 +24,10 @@ void UGameInfoManager::NewSaveGame() void UGameInfoManager::SaveGameInfo() { - if (!IsValid(PlayerInfo.Get())) + if (!IsValid(PlayerInfo)) { - PlayerInfo = NewObject(this); + + PlayerInfo = NewObject(GetGameInstance()); } // 保存任务数据 if (UQuestManager* QuestManager = GetGameInstance()->GetSubsystem()) @@ -34,7 +35,7 @@ void UGameInfoManager::SaveGameInfo() PlayerInfo->QuestSaveData = QuestManager->GetQuestSaveData(); } - if (UGameplayStatics::SaveGameToSlot(PlayerInfo.Get(), SaveGameSlotName, 0)) + if (UGameplayStatics::SaveGameToSlot(PlayerInfo, SaveGameSlotName, 0)) { UE_LOG(LogTemp, Warning, TEXT("存档保存成功")); } @@ -49,7 +50,7 @@ bool UGameInfoManager::LoadGameInfo() if (UGameplayStatics::DoesSaveGameExist(SaveGameSlotName, 0)) { PlayerInfo = Cast(UGameplayStatics::LoadGameFromSlot(SaveGameSlotName, 0)); - + PlayerInfo->Rename(nullptr, this); // 加载任务数据 if (UQuestManager* QuestManager = GetGameInstance()->GetSubsystem()) { @@ -74,7 +75,8 @@ bool UGameInfoManager::LoadGameInfo() void UGameInfoManager::CreateGameInfo(UContainerInfo* ShipContainer, UContainerInfo* PlayerContainer) { - PlayerInfo = NewObject(this); + if (!IsValid(PlayerInfo)) + PlayerInfo = NewObject(GetGameInstance()); PlayerInfo->ShipContainerItems = ShipContainer->GetSaveData(); PlayerInfo->ShipContainerShapeID = ShipContainer->ContainerShape->GetPrimaryAssetId(); @@ -93,7 +95,7 @@ void UGameInfoManager::CreateGameInfoAndSave(UShapeAsset* ShipContainerShape, US PlayerContainer->InitContainerByShape(PlayerContainerShape); //创建要保存的额存档信息 - PlayerInfo = NewObject(this); + PlayerInfo = NewObject(GetGameInstance()); PlayerInfo->ShipContainerItems = ShipContainer->GetSaveData(); PlayerInfo->ShipContainerShapeID = ShipContainer->ContainerShape->GetPrimaryAssetId(); @@ -119,7 +121,7 @@ void UGameInfoManager::SetTutorialMode(bool bTutorialMode) { if (!IsValid(PlayerInfo)) { - PlayerInfo = NewObject(this); + PlayerInfo = NewObject(GetGameInstance()); } PlayerInfo->TutorialMode = bTutorialMode; } @@ -137,7 +139,7 @@ void UGameInfoManager::AddDefeatedFish(int32 FishID) { if (!IsValid(PlayerInfo)) { - PlayerInfo = NewObject(this); + PlayerInfo = NewObject(GetGameInstance()); } PlayerInfo->Fish_defeated_IDS.Add(FishID); SaveGameInfo(); diff --git a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/GameInfoManager.h b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/GameInfoManager.h index 8ca981d..26cf5be 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/GameInfoManager.h +++ b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/GameInfoManager.h @@ -3,6 +3,7 @@ #pragma once #include "CoreMinimal.h" +#include "DialogueAsset.h" #include "ProjectFish/Data/PlayerInfoSaveGame.h" #include "Subsystems/GameInstanceSubsystem.h" #include "GameInfoManager.generated.h" @@ -41,9 +42,11 @@ public: UFUNCTION(BlueprintCallable) void AddDefeatedFish(int32 FishID); + + TObjectPtr GetPlayerInfo() {return PlayerInfo;} protected: - UPROPERTY(BlueprintReadOnly) - TObjectPtr PlayerInfo; + UPROPERTY(BlueprintReadWrite) + class UPlayerInfoSaveGame* PlayerInfo; static FString SaveGameSlotName; }; diff --git a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/TutorialManagerSubsystem.cpp b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/TutorialManagerSubsystem.cpp index 6221769..86bd884 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/TutorialManagerSubsystem.cpp +++ b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/TutorialManagerSubsystem.cpp @@ -32,6 +32,7 @@ void UTutorialManagerSubsystem::ApplyCurrentTutorialStep() { if (TutorialSteps.Num() > CurrentTutorialStep ) { + UE_LOG(LogTemp, Warning, TEXT("执行 CurrentTutorialStep = %d || name = %s "), CurrentTutorialStep, *GetCurrentTutorialStep().StepName.ToString() ); bTutorialing = true; FTutorialStep CurrentStep = TutorialSteps[CurrentTutorialStep]; if (IsValid(CurrentStep.Dialogue)) @@ -52,8 +53,7 @@ void UTutorialManagerSubsystem::ApplyCurrentTutorialStep() } if (IsValid(CurrentStep.TutorialTaskClass)) { - TutorialTaskObject = NewObject< UTutorialTask_Base>(this); - TutorialTaskObject->Execute(GetWorld()->GetAuthGameMode()); + CreateTask(); } } else @@ -69,6 +69,7 @@ void UTutorialManagerSubsystem::CompleteTutorialStep() { if (TutorialTaskObject) { + TutorialTaskObject->BeforTutorialComplete(); TutorialTaskObject->ConditionalBeginDestroy(); TutorialTaskObject = nullptr; } @@ -77,7 +78,7 @@ void UTutorialManagerSubsystem::CompleteTutorialStep() TutorialWidget->RemoveFromViewport(); TutorialWidget = nullptr; } - UE_LOG(LogTemp, Warning, TEXT("教程进行下一步 currentstep = %d"), CurrentTutorialStep); + UE_LOG(LogTemp, Warning, TEXT(" 教程进行下一步")); OnStepComplete.Broadcast(CurrentTutorialStep); CurrentTutorialStep++; ApplyCurrentTutorialStep(); @@ -167,6 +168,7 @@ void UTutorialManagerSubsystem::ControlUI() void UTutorialManagerSubsystem::CreateTask() { - TutorialTask = NewObject(this); - TutorialTask->Execute(GetWorld()->GetAuthGameMode()); + FTutorialStep CurrentStep = TutorialSteps[CurrentTutorialStep]; + TutorialTaskObject = NewObject(this, CurrentStep.TutorialTaskClass); + TutorialTaskObject->Execute(GetWorld()->GetAuthGameMode()); } diff --git a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/TutorialManagerSubsystem.h b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/TutorialManagerSubsystem.h index d120c7e..fd164e7 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/TutorialManagerSubsystem.h +++ b/ProjectFish/Source/ProjectFish/Gameplay/Subsystem/TutorialManagerSubsystem.h @@ -12,7 +12,7 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnStepComplete, int32, CompleteInde /** * */ -UCLASS() +UCLASS(BlueprintType) class PROJECTFISH_API UTutorialManagerSubsystem : public UGameInstanceSubsystem { GENERATED_BODY() @@ -48,10 +48,11 @@ protected: void ControlUI(); //创建task void CreateTask(); -private: +protected: FDelegateHandle LevelLoadedDelegateHandle; UPROPERTY(BlueprintAssignable) FOnStepComplete OnStepComplete; + UPROPERTY(BlueprintReadOnly) bool bTutorialing; TArray TutorialSteps; diff --git a/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_Base.h b/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_Base.h index 0e25542..b5a2291 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_Base.h +++ b/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_Base.h @@ -24,4 +24,5 @@ public: UFUNCTION(BlueprintNativeEvent, Category= "TutorialTask") void BeforTutorialComplete(); virtual void BeforTutorialComplete_Implementation(); + }; diff --git a/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_CheckShipContainer.cpp b/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_CheckShipContainer.cpp index 943f1b3..952d6e5 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_CheckShipContainer.cpp +++ b/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_CheckShipContainer.cpp @@ -3,13 +3,32 @@ #include "TutorialTask_CheckShipContainer.h" +#include "GameFramework/GameModeBase.h" +#include "ProjectFish/Gameplay/Subsystem/GameInfoManager.h" +#include "ProjectFish/Gameplay/Subsystem/TutorialManagerSubsystem.h" + + void UTutorialTask_CheckShipContainer::Execute_Implementation(class AGameModeBase* GameMode) { Super::Execute_Implementation(GameMode); - + if (GameMode) + { + GameMode->GetGameInstance()->GetSubsystem()->GetPlayerInfo() + ->OnShipContainerUpdate.AddDynamic(this, &UTutorialTask_CheckShipContainer::OnShipContainerUpdate); + } } void UTutorialTask_CheckShipContainer::BeforTutorialComplete_Implementation() { Super::BeforTutorialComplete_Implementation(); } + +void UTutorialTask_CheckShipContainer::OnShipContainerUpdate() +{ + //只有3个物品时才完成当前的引导步骤 + int CurrentItemCount = GetOuter()->GetWorld()->GetGameInstance()->GetSubsystem()->GetPlayerInfo()->ShipContainerItems.Num(); + if (CurrentItemCount == ReqItemsCount) + { + Cast(GetOuter())->CompleteTutorialStep(); + } +} diff --git a/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_CheckShipContainer.h b/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_CheckShipContainer.h index af6d271..5185d23 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_CheckShipContainer.h +++ b/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_CheckShipContainer.h @@ -13,7 +13,14 @@ UCLASS() class PROJECTFISH_API UTutorialTask_CheckShipContainer : public UTutorialTask_Base { GENERATED_BODY() + virtual void Execute_Implementation(class AGameModeBase* GameMode) override; virtual void BeforTutorialComplete_Implementation() override; + + UFUNCTION() + void OnShipContainerUpdate(); +protected: + UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "TutorialTask_CheckShipContainer") + int32 ReqItemsCount; }; diff --git a/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_GamePause.cpp b/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_GamePause.cpp index 265ce4b..d698df7 100644 --- a/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_GamePause.cpp +++ b/ProjectFish/Source/ProjectFish/Gameplay/TutorialSystem/TutorialTask_GamePause.cpp @@ -8,11 +8,11 @@ void UTutorialTask_GamePause::Execute_Implementation(class AGameModeBase* GameMode) { Super::Execute_Implementation(GameMode); - LevelLoadedDelegateHandle = FCoreUObjectDelegates::PostLoadMapWithWorld.AddUObject( - this, - &UTutorialTask_GamePause::OnLevelLoaded - ); - + // LevelLoadedDelegateHandle = FCoreUObjectDelegates::PostLoadMapWithWorld.AddUObject( + // this, + // &UTutorialTask_GamePause::OnLevelLoaded + // ); + UGameplayStatics::SetGamePaused(this, true); } void UTutorialTask_GamePause::BeforTutorialComplete_Implementation() @@ -23,15 +23,15 @@ void UTutorialTask_GamePause::BeforTutorialComplete_Implementation() void UTutorialTask_GamePause::OnLevelLoaded(UWorld* World) { - FCoreUObjectDelegates::PostLoadMapWithWorld.Remove(LevelLoadedDelegateHandle); - FTimerHandle LambdaTimerHandle; - GetWorld()->GetTimerManager().SetTimer( - LambdaTimerHandle, - [this]() - { - UGameplayStatics::SetGamePaused(this, true); - }, - 1.5f, - false - ); + // FCoreUObjectDelegates::PostLoadMapWithWorld.Remove(LevelLoadedDelegateHandle); + // FTimerHandle LambdaTimerHandle; + // GetWorld()->GetTimerManager().SetTimer( + // LambdaTimerHandle, + // [this]() + // { + // UGameplayStatics::SetGamePaused(this, true); + // }, + // 1.5f, + // false + // ); } diff --git a/ProjectFish/Source/ProjectFish/Skill/SkillManager.cpp b/ProjectFish/Source/ProjectFish/Skill/SkillManager.cpp index ea668dd..c4c31e4 100644 --- a/ProjectFish/Source/ProjectFish/Skill/SkillManager.cpp +++ b/ProjectFish/Source/ProjectFish/Skill/SkillManager.cpp @@ -23,7 +23,7 @@ void USkillManager::Tick(float DeltaTime) bool USkillManager::IsTickable() const { - return !bGameEnd && IsValid(GameMode) && GameMode->GetBattleIsBegin(); + return !bGameEnd && IsValid(GameMode) && GameMode->GetBattleIsBegin() && !GameMode->IsPaused(); } TStatId USkillManager::GetStatId() const