4#include "Net/UnrealNetwork.h"
31 UE_LOG(LogStoryManager, Warning, TEXT(
"AStoryManager::InitNewStory StoryDataArray is empty"));
38 UE_LOG(LogStoryManager, Warning, TEXT(
"AStoryManager::InitNewStory Index out of range"));
87 UE_LOG(LogStoryManager, Warning, TEXT(
"AStoryManager::GoToNextStep Index out of range"));
108 UE_LOG(LogStoryManager, Log, TEXT(
"AStoryManager::GoToNextStep Next Step %s"), *
CurrentStep.
StepName.ToString());
133 UE_LOG(LogStoryManager, Log, TEXT(
"AStoryManager::GoToNextSubStep Next SubStep %s"),
164 UE_LOG(LogStoryManager, Warning, TEXT(
"AStoryManager::JumpToStepByIndex Couldn't find a step by index %d"),
174 for (
int i =
StepIndex - 1; i >= index; i--)
205 UE_LOG(LogStoryManager, Log, TEXT(
"AStoryManager::JumpToStepByIndex Jump To Step %s"),
216 for (
int i = 0; i <
StepData.Num(); i++)
218 if (stepId.EqualTo(
StepData[i].Step.StepName))
228 UE_LOG(LogStoryManager, Warning, TEXT(
"AStoryManager::JumpToStepByName Couldn't find a step %s"),
238 for (
int i =
StepIndex - 1; i >= index; i--)
269 UE_LOG(LogStoryManager, Log, TEXT(
"AStoryManager::JumpToStepByName Jump To Step %s"),
312 for (
auto SpecificParameter : SpecificParameters)
314 bool SpecificParameterFounded =
false;
317 if (SpecificParameter.EqualTo(Parameter))
319 SpecificParameterFounded =
true;
323 if (!SpecificParameterFounded)
341 bool isCompleted =
true;
344 if (!steps.Completed)
354 bool StoryAlreadyInArray =
false;
355 int32 FoundedStoryIndex = 0;
360 StoryAlreadyInArray =
true;
361 FoundedStoryIndex = i;
364 if (StoryAlreadyInArray)
379 Super::GetLifetimeReplicatedProps(OutLifetimeProps);
400 UE_LOG(LogStoryManager, Error, TEXT(
"AStoryManager::UInitializationEvent StoryDataArray is empty"));
#define DEFINE_EVENT_HANDLER(TEventType)
DEFINE_LOG_CATEGORY(LogStoryManager)
static FUNCTION_NON_NULL_RETURN_START TEventType * NewEvent(APlayerController *Executor=nullptr) FUNCTION_NON_NULL_RETURN_END
Creates a new event of the specified type.
void HandleEvent_Impl(class UBaseEvent *Event)
Event called when we on init experience.
A component responsible for managing the story progression in story actors.
TArray< FStepData > StepData
UPROPERTY(EditAnywhere, BlueprintReadWrite)
Manager that provides handling story-related operations and data.
int StoryIndex
UPROPERTY(BlueprintReadWrite, Replicated)
FOnStepSkipped OnStepSkipped
UPROPERTY(BlueprintAssignable, Category = "Story Delegate")
TArray< UStoryComponent * > StoryComponents
UPROPERTY()
FOnNewStep OnNewStep
UPROPERTY(BlueprintAssignable, Category = "Story Delegate")
FStoryStep PreviousStep
UPROPERTY(BlueprintReadWrite, Replicated)
bool JumpToStepByIndex(int index)
UFUNCTION(BlueprintCallable)
void RecordStoryStepData()
Records the data for a story step. It checks if the story is already present in the PassedExperiences...
bool JumpToStepByName(FText stepId)
UFUNCTION(BlueprintCallable)
UStoryData * StoryData
UPROPERTY(BlueprintReadWrite, Replicated)
TArray< FPassedExperiences > PassedExperiencesArray
UPROPERTY(BlueprintReadWrite)
FStoryStep CurrentSubStep
UPROPERTY(BlueprintReadWrite, Replicated)
int StepIndex
UPROPERTY(BlueprintReadWrite, Replicated)
FOnStoryLoaded OnStoryLoaded
UPROPERTY(BlueprintAssignable, Category = "Story Delegate")
int SubStepIndex
UPROPERTY(BlueprintReadWrite, Replicated)
void CompleteSubStep(FStoryStep completedStep)
UFUNCTION(BlueprintCallable)
static TArray< FText > StoryParameters
void AddStoryComponent(UStoryComponent *storyComponent)
bool InitNewStory(int newStoryIndex)
Choose one story from StoryDataArray.
bool BlockStory
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray< UStoryData * > StoryDataArray
UPROPERTY(EditAnywhere, BlueprintReadWrite)
virtual void GetLifetimeReplicatedProps(TArray< FLifetimeProperty > &OutLifetimeProps) const override
bool GoToNextSubStep()
UFUNCTION(BlueprintCallable)
bool GoToNextStep()
UFUNCTION(BlueprintCallable)
static void SetupNextStory(int newNextStoryIndex, TArray< FText > newStoryParameters)
UFUNCTION(BlueprintCallable)
static bool IsSpecificParametersExist(TArray< FText > SpecificParameters)
UFUNCTION(BlueprintCallable)
TArray< FStepData > StepData
UPROPERTY(BlueprintReadWrite, Replicated)
FOnStepCompleted OnStepCompleted
UPROPERTY(BlueprintAssignable, Category = "Story Delegate")
void StepCompleted(FText stepToUpdate, bool goToNext=true)
UFUNCTION(BlueprintCallable)
bool StoryFinished
UPROPERTY(BlueprintReadOnly)
FOnNewSubStep OnNewSubStep
UPROPERTY(BlueprintAssignable, Category = "Story Delegate")
static int NextStoryIndex
Keeps track of which story should be loaded next by index, saved between levels.
bool IsAllSubStepsCompleted()
UFUNCTION()
FStoryStep CurrentStep
UPROPERTY(BlueprintReadWrite, Replicated)
float GetCurrentStepDuration() const
UFUNCTION(BlueprintCallable, Category = "StoryManager|Misc")
FOnEndOfStory OnEndOfStory
UPROPERTY(BlueprintAssignable, Category = "Story Delegate")
FDateTime StepStartingTime
int32 StoryIndex
UPROPERTY(BlueprintReadWrite)
TArray< FStepData > PassedStepData
UPROPERTY(BlueprintReadWrite)
bool operator==(const FStoryStep &Step) const
FText StepName
UPROPERTY(BlueprintReadWrite, EditAnywhere)
bool Completed
UPROPERTY(BlueprintReadWrite, EditAnywhere)