Compare commits

...

2 Commits

4 changed files with 112 additions and 12 deletions

View File

@ -0,0 +1,57 @@
// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action.
#include "DataAssets/OLSExperienceActionSet.h"
#if WITH_EDITOR
#include "Misc/DataValidation.h"
#endif
#include "GameFeatureAction.h"
#include UE_INLINE_GENERATED_CPP_BY_NAME(OLSExperienceActionSet)
#define LOCTEXT_NAMESPACE "OLSSystem"
#if WITH_EDITOR
EDataValidationResult UOLSExperienceActionSet::IsDataValid(FDataValidationContext& context) const
{
EDataValidationResult result = CombineDataValidationResults(Super::IsDataValid(context), EDataValidationResult::Valid);
int32 entryIndex = 0;
for (const UGameFeatureAction* action : Actions)
{
if (action)
{
EDataValidationResult ChildResult = action->IsDataValid(context);
result = CombineDataValidationResults(result, ChildResult);
}
else
{
result = EDataValidationResult::Invalid;
context.AddError(FText::Format(LOCTEXT("ActionEntryIsNull", "Null entry at index {0} in Actions"), FText::AsNumber(entryIndex)));
}
++entryIndex;
}
return result;
}
#endif
#if WITH_EDITORONLY_DATA
void UOLSExperienceActionSet::UpdateAssetBundleData()
{
Super::UpdateAssetBundleData();
for (UGameFeatureAction* action : Actions)
{
if (action)
{
action->AddAdditionalAssetBundleData(AssetBundleData);
}
}
}
#endif // WITH_EDITORONLY_DATA
#undef LOCTEXT_NAMESPACE

View File

@ -9,6 +9,7 @@
#include "GameFeatureAction.h"
#include "GameFeaturesSubsystemSettings.h"
#include "TimerManager.h"
#include "DataAssets/OLSExperienceActionSet.h"
#include "DataAssets/OLSExperienceDefinitionPrimaryDataAsset.h"
#include "Net/UnrealNetwork.h"
#include "Systems/OLSAssetManager.h"
@ -224,14 +225,14 @@ void UOLSExperienceManagerComponent::StartExperienceLoad()
TSet<FSoftObjectPath> rawAssetList;
bundleAssetList.Add(CurrentExperience->GetPrimaryAssetId());
// @Todo implement this
// for (const TObjectPtr<ULyraExperienceActionSet>& ActionSet : CurrentExperience->ActionSets)
// {
// if (ActionSet != nullptr)
// {
// BundleAssetList.Add(ActionSet->GetPrimaryAssetId());
// }
// }
for (const TObjectPtr<UOLSExperienceActionSet>& actionSet : CurrentExperience->ActionSets)
{
if (actionSet != nullptr)
{
bundleAssetList.Add(actionSet->GetPrimaryAssetId());
}
}
// Load assets associated with the experience

View File

@ -0,0 +1,42 @@
// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action.
#pragma once
#include "CoreMinimal.h"
#include "OLSPawnPrimaryDataAsset.h"
#include "OLSExperienceActionSet.generated.h"
/**
* Definition of a set of actions to perform as part of entering an experience
*/
UCLASS(BlueprintType, NotBlueprintable)
class OLS_API UOLSExperienceActionSet : public UOLSPawnPrimaryDataAsset
{
GENERATED_BODY()
public:
//~ Begin UObject interface
#if WITH_EDITOR
virtual EDataValidationResult IsDataValid(class FDataValidationContext& context) const override;
#endif
//~ End UObject interface
//~ Begin UPrimaryDataAsset interface
#if WITH_EDITORONLY_DATA
virtual void UpdateAssetBundleData() override;
#endif
//~ End UPrimaryDataAsset interface
public:
// List of actions to perform as this experience is loaded/activated/deactivated/unloaded
UPROPERTY(EditAnywhere, Instanced, Category="Actions to Perform")
TArray<TObjectPtr<class UGameFeatureAction>> Actions;
// List of Game Feature Plugins this experience wants to have active
UPROPERTY(EditAnywhere, Category="Feature Dependencies")
TArray<FString> GameFeaturesToEnable;
};

View File

@ -42,14 +42,14 @@ public:
TArray<FString> GameFeaturesToEnable;
/** The default pawn class to spawn for players */
// UPROPERTY(EditDefaultsOnly, Category = "OLSExperienceDefinition")
// TObjectPtr<const ULyraPawnData> DefaultPawnData;
UPROPERTY(EditDefaultsOnly, Category = "OLSExperienceDefinition")
TObjectPtr<const class UOLSPawnPrimaryDataAsset> DefaultPawnData = nullptr;
// List of actions to perform as this experience is loaded/activated/deactivated/unloaded
UPROPERTY(EditDefaultsOnly, Instanced, Category = "OLSExperienceDefinition")
TArray<TObjectPtr<class UGameFeatureAction>> Actions;
// List of additional action sets to compose into this experience
// UPROPERTY(EditDefaultsOnly, Category = "OLSExperienceDefinition")
// TArray<TObjectPtr<class ULyraExperienceActionSet>> ActionSets;
UPROPERTY(EditDefaultsOnly, Category = "OLSExperienceDefinition")
TArray<TObjectPtr<class UOLSExperienceActionSet>> ActionSets;
};