更新引导系统

This commit is contained in:
997146918 2025-11-24 17:31:52 +08:00
parent d5c3c82fec
commit 9711095c25
6 changed files with 108 additions and 0 deletions

View File

@ -11,6 +11,7 @@
#include "Engine/StreamableManager.h"
#include "Kismet/GameplayStatics.h"
#include "ProjectFish/DataAsset/QuestAsset.h"
#include "ProjectFish/Gameplay/TutorialSystem/TutorialTask_Base.h"
#include "ProjectFish/Widget/DialogueWidget_Base.h"
#include "ProjectFish/Widget/TutorialControlWidget_Base.h"
@ -49,6 +50,10 @@ void UTutorialManagerSubsystem::ApplyCurrentTutorialStep()
{
ControlUI();
}
if (IsValid(CurrentStep.TutorialTaskClass))
{
}
}
else
{
@ -61,6 +66,11 @@ void UTutorialManagerSubsystem::CompleteTutorialStep()
{
if (bTutorialing)
{
if (TutorialTask)
{
TutorialTask->ConditionalBeginDestroy();
TutorialTask = nullptr;
}
UE_LOG(LogTemp, Warning, TEXT("教程进行下一步 currentstep = %d"), CurrentTutorialStep);
OnStepComplete.Broadcast(CurrentTutorialStep);
CurrentTutorialStep++;
@ -147,3 +157,9 @@ void UTutorialManagerSubsystem::ControlUI()
}
}
void UTutorialManagerSubsystem::CreateTask()
{
TutorialTask = NewObject<UTutorialTask_Base>(this);
TutorialTask->Execute(GetWorld()->GetAuthGameMode());
}

View File

@ -46,6 +46,8 @@ protected:
void ShowTutorialUI();
//控制指定UI
void ControlUI();
//创建task
void CreateTask();
private:
FDelegateHandle LevelLoadedDelegateHandle;
UPROPERTY(BlueprintAssignable)
@ -57,4 +59,7 @@ private:
FString DialogueUIPath;
UPROPERTY()
class UDialogueWidget_Base* DialogueWidget;
UPROPERTY()
class UTutorialTask_Base* TutorialTask;
};

View File

@ -0,0 +1,21 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "TutorialTask_Base.h"
#include "ProjectFish/Gameplay/Subsystem/TutorialManagerSubsystem.h"
// void UTutorialTask_Base::BeginDestroy()
// {
// UObject::BeginDestroy();
// //task 删除的时候自动完成该引导step
// if (GetWorld())
// GetWorld()->GetGameInstance()->GetSubsystem<UTutorialManagerSubsystem>()->CompleteTutorialStep();
// }
void UTutorialTask_Base::Execute_Implementation(class AGameModeBase* GameMode)
{
}
void UTutorialTask_Base::BeforTutorialComplete_Implementation()
{
}

View File

@ -0,0 +1,27 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Object.h"
#include "TutorialTask_Base.generated.h"
/**
*
*/
UCLASS(Blueprintable)
class PROJECTFISH_API UTutorialTask_Base : public UObject
{
GENERATED_BODY()
public:
/** UObject */
//virtual void BeginDestroy() override;
UFUNCTION(BlueprintNativeEvent, Category= "TutorialTask")
void Execute(class AGameModeBase* GameMode);
virtual void Execute_Implementation(class AGameModeBase* GameMode);
UFUNCTION(BlueprintNativeEvent, Category= "TutorialTask")
void BeforTutorialComplete();
virtual void BeforTutorialComplete_Implementation();
};

View File

@ -0,0 +1,18 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "TutorialTask_GamePause.h"
#include "Kismet/GameplayStatics.h"
void UTutorialTask_GamePause::Execute_Implementation(class AGameModeBase* GameMode)
{
Super::Execute_Implementation(GameMode);
UGameplayStatics::SetGamePaused(this, true);
}
void UTutorialTask_GamePause::BeforTutorialComplete_Implementation()
{
Super::BeforTutorialComplete_Implementation();
UGameplayStatics::SetGamePaused(this, false);
}

View File

@ -0,0 +1,21 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "TutorialTask_Base.h"
#include "TutorialTask_GamePause.generated.h"
/**
*
*/
UCLASS()
class PROJECTFISH_API UTutorialTask_GamePause : public UTutorialTask_Base
{
GENERATED_BODY()
public:
virtual void Execute_Implementation(class AGameModeBase* GameMode) override;
virtual void BeforTutorialComplete_Implementation() override;
};