// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "CoreUObject.h" #include "Kismet/BlueprintFunctionLibrary.h" #include "LyraInventoryItemDefinition.generated.h" class ULyraInventoryItemInstance; ////////////////////////////////////////////////////////////////////// // Represents a fragment of an item definition UCLASS(DefaultToInstanced, EditInlineNew, Abstract) class ULyraInventoryItemFragment : public UObject { GENERATED_BODY() public: virtual void OnInstanceCreated(ULyraInventoryItemInstance* Instance) const {} }; ////////////////////////////////////////////////////////////////////// /** * ULyraInventoryItemDefinition */ UCLASS(Blueprintable, Const, Abstract) class ULyraInventoryItemDefinition : public UObject { GENERATED_BODY() public: ULyraInventoryItemDefinition(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=Display) FText DisplayName; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category=Display, Instanced) TArray> Fragments; public: const ULyraInventoryItemFragment* FindFragmentByClass(TSubclassOf FragmentClass) const; }; //@TODO: Make into a subsystem instead? UCLASS() class ULyraInventoryFunctionLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() UFUNCTION(BlueprintCallable, meta=(DeterminesOutputType=FragmentClass)) static const ULyraInventoryItemFragment* FindItemDefinitionFragment(TSubclassOf ItemDef, TSubclassOf FragmentClass); };