2022-05-23 18:41:30 +00:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "Containers/Array.h"
|
|
|
|
#include "Internationalization/Text.h"
|
2022-05-23 18:41:30 +00:00
|
|
|
#include "Kismet/BlueprintFunctionLibrary.h"
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "Templates/SubclassOf.h"
|
|
|
|
#include "UObject/Object.h"
|
|
|
|
#include "UObject/ObjectPtr.h"
|
|
|
|
#include "UObject/UObjectGlobals.h"
|
|
|
|
|
2022-05-23 18:41:30 +00:00
|
|
|
#include "LyraInventoryItemDefinition.generated.h"
|
|
|
|
|
|
|
|
class ULyraInventoryItemInstance;
|
2022-09-13 07:18:28 +00:00
|
|
|
struct FFrame;
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// Represents a fragment of an item definition
|
|
|
|
UCLASS(DefaultToInstanced, EditInlineNew, Abstract)
|
2022-09-13 07:18:28 +00:00
|
|
|
class LYRAGAME_API ULyraInventoryItemFragment : public UObject
|
2022-05-23 18:41:30 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
};
|