修复bug
This commit is contained in:
parent
1a5c391707
commit
a83eeacbc5
Binary file not shown.
Binary file not shown.
@ -514,5 +514,8 @@ public:
|
|||||||
//引导task
|
//引导task
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Tutorial Asset")
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Tutorial Asset")
|
||||||
TSubclassOf<class UTutorialTask_Base> TutorialTaskClass;
|
TSubclassOf<class UTutorialTask_Base> TutorialTaskClass;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
UTutorialTask_Base* TutorialTaskObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,8 @@ void UTutorialManagerSubsystem::ApplyCurrentTutorialStep()
|
|||||||
}
|
}
|
||||||
if (IsValid(CurrentStep.TutorialTaskClass))
|
if (IsValid(CurrentStep.TutorialTaskClass))
|
||||||
{
|
{
|
||||||
|
TutorialTaskObject = NewObject< UTutorialTask_Base>(this);
|
||||||
|
TutorialTaskObject->Execute(GetWorld()->GetAuthGameMode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -66,10 +67,15 @@ void UTutorialManagerSubsystem::CompleteTutorialStep()
|
|||||||
{
|
{
|
||||||
if (bTutorialing)
|
if (bTutorialing)
|
||||||
{
|
{
|
||||||
if (TutorialTask)
|
if (TutorialTaskObject)
|
||||||
{
|
{
|
||||||
TutorialTask->ConditionalBeginDestroy();
|
TutorialTaskObject->ConditionalBeginDestroy();
|
||||||
TutorialTask = nullptr;
|
TutorialTaskObject = nullptr;
|
||||||
|
}
|
||||||
|
if (TutorialWidget)
|
||||||
|
{
|
||||||
|
TutorialWidget->RemoveFromViewport();
|
||||||
|
TutorialWidget = nullptr;
|
||||||
}
|
}
|
||||||
UE_LOG(LogTemp, Warning, TEXT("教程进行下一步 currentstep = %d"), CurrentTutorialStep);
|
UE_LOG(LogTemp, Warning, TEXT("教程进行下一步 currentstep = %d"), CurrentTutorialStep);
|
||||||
OnStepComplete.Broadcast(CurrentTutorialStep);
|
OnStepComplete.Broadcast(CurrentTutorialStep);
|
||||||
@ -138,7 +144,7 @@ void UTutorialManagerSubsystem::AccepAndFollowQuest()
|
|||||||
void UTutorialManagerSubsystem::ShowTutorialUI()
|
void UTutorialManagerSubsystem::ShowTutorialUI()
|
||||||
{
|
{
|
||||||
FTutorialStep CurrentStep = TutorialSteps[CurrentTutorialStep];
|
FTutorialStep CurrentStep = TutorialSteps[CurrentTutorialStep];
|
||||||
UUserWidget* TutorialWidget = CreateWidget<UUserWidget>(GetWorld(), CurrentStep.TutorialUI);
|
TutorialWidget = CreateWidget<UUserWidget>(GetWorld(), CurrentStep.TutorialUI);
|
||||||
TutorialWidget->AddToViewport(99);
|
TutorialWidget->AddToViewport(99);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,10 @@ private:
|
|||||||
FString DialogueUIPath;
|
FString DialogueUIPath;
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
class UDialogueWidget_Base* DialogueWidget;
|
class UDialogueWidget_Base* DialogueWidget;
|
||||||
|
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
class UTutorialTask_Base* TutorialTask;
|
UUserWidget* TutorialWidget;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
class UTutorialTask_Base* TutorialTaskObject;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -8,7 +8,11 @@
|
|||||||
void UTutorialTask_GamePause::Execute_Implementation(class AGameModeBase* GameMode)
|
void UTutorialTask_GamePause::Execute_Implementation(class AGameModeBase* GameMode)
|
||||||
{
|
{
|
||||||
Super::Execute_Implementation(GameMode);
|
Super::Execute_Implementation(GameMode);
|
||||||
UGameplayStatics::SetGamePaused(this, true);
|
LevelLoadedDelegateHandle = FCoreUObjectDelegates::PostLoadMapWithWorld.AddUObject(
|
||||||
|
this,
|
||||||
|
&UTutorialTask_GamePause::OnLevelLoaded
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UTutorialTask_GamePause::BeforTutorialComplete_Implementation()
|
void UTutorialTask_GamePause::BeforTutorialComplete_Implementation()
|
||||||
@ -16,3 +20,18 @@ void UTutorialTask_GamePause::BeforTutorialComplete_Implementation()
|
|||||||
Super::BeforTutorialComplete_Implementation();
|
Super::BeforTutorialComplete_Implementation();
|
||||||
UGameplayStatics::SetGamePaused(this, false);
|
UGameplayStatics::SetGamePaused(this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UTutorialTask_GamePause::OnLevelLoaded(UWorld* World)
|
||||||
|
{
|
||||||
|
FCoreUObjectDelegates::PostLoadMapWithWorld.Remove(LevelLoadedDelegateHandle);
|
||||||
|
FTimerHandle LambdaTimerHandle;
|
||||||
|
GetWorld()->GetTimerManager().SetTimer(
|
||||||
|
LambdaTimerHandle,
|
||||||
|
[this]()
|
||||||
|
{
|
||||||
|
UGameplayStatics::SetGamePaused(this, true);
|
||||||
|
},
|
||||||
|
1.5f,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@ -18,4 +18,8 @@ public:
|
|||||||
virtual void Execute_Implementation(class AGameModeBase* GameMode) override;
|
virtual void Execute_Implementation(class AGameModeBase* GameMode) override;
|
||||||
|
|
||||||
virtual void BeforTutorialComplete_Implementation() override;
|
virtual void BeforTutorialComplete_Implementation() override;
|
||||||
|
|
||||||
|
void OnLevelLoaded(UWorld* World);
|
||||||
|
private:
|
||||||
|
FDelegateHandle LevelLoadedDelegateHandle;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user