RealtimeStyleTransferRuntime/Source/LyraGame/Inventory/LyraInventoryItemDefinition.h

56 lines
1.7 KiB
C++

// 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<TObjectPtr<ULyraInventoryItemFragment>> Fragments;
public:
const ULyraInventoryItemFragment* FindFragmentByClass(TSubclassOf<ULyraInventoryItemFragment> 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<ULyraInventoryItemDefinition> ItemDef, TSubclassOf<ULyraInventoryItemFragment> FragmentClass);
};