2022-05-23 18:41:30 +00:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
#include "LyraInventoryItemDefinition.h"
|
|
|
|
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "UObject/Class.h"
|
|
|
|
|
2022-05-23 18:41:30 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// ULyraInventoryItemDefinition
|
|
|
|
|
|
|
|
ULyraInventoryItemDefinition::ULyraInventoryItemDefinition(const FObjectInitializer& ObjectInitializer)
|
|
|
|
: Super(ObjectInitializer)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
const ULyraInventoryItemFragment* ULyraInventoryItemDefinition::FindFragmentByClass(TSubclassOf<ULyraInventoryItemFragment> FragmentClass) const
|
|
|
|
{
|
|
|
|
if (FragmentClass != nullptr)
|
|
|
|
{
|
|
|
|
for (ULyraInventoryItemFragment* Fragment : Fragments)
|
|
|
|
{
|
|
|
|
if (Fragment && Fragment->IsA(FragmentClass))
|
|
|
|
{
|
|
|
|
return Fragment;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// ULyraInventoryItemDefinition
|
|
|
|
|
|
|
|
const ULyraInventoryItemFragment* ULyraInventoryFunctionLibrary::FindItemDefinitionFragment(TSubclassOf<ULyraInventoryItemDefinition> ItemDef, TSubclassOf<ULyraInventoryItemFragment> FragmentClass)
|
|
|
|
{
|
|
|
|
if ((ItemDef != nullptr) && (FragmentClass != nullptr))
|
|
|
|
{
|
|
|
|
return GetDefault<ULyraInventoryItemDefinition>(ItemDef)->FindFragmentByClass(FragmentClass);
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|