Added ClothingItemInstance and cleanup the project
This commit is contained in:
@@ -2,9 +2,8 @@
|
||||
|
||||
|
||||
#include "EquipClothingRestriction.h"
|
||||
|
||||
#include "NakedDesire/Clothing/ClothingItem.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemData.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemInstance.h"
|
||||
#include "NakedDesire/Clothing/ClothingManager.h"
|
||||
#include "NakedDesire/Player/NakedDesireCharacter.h"
|
||||
|
||||
@@ -64,11 +63,11 @@ FText UEquipClothingRestriction::GetDescription() const
|
||||
});
|
||||
}
|
||||
|
||||
void UEquipClothingRestriction::OnClothingEquipped(const UClothingItemData* ClothingData)
|
||||
void UEquipClothingRestriction::OnClothingEquipped(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
const bool IsTargetClothing = ClothingItems.FindByPredicate([&ClothingData](const UClothingItem* Item)
|
||||
const bool IsTargetClothing = ClothingItems.FindByPredicate([&ClothingItemInstance](const UClothingItem* Item)
|
||||
{
|
||||
return Item && Item->Name.EqualTo(ClothingData->Info->Name);
|
||||
return Item && Item->Name.EqualTo(ClothingItemInstance->GetClothingItem()->Name);
|
||||
}) != nullptr;
|
||||
if (IsTargetClothing)
|
||||
{
|
||||
@@ -76,11 +75,11 @@ void UEquipClothingRestriction::OnClothingEquipped(const UClothingItemData* Clot
|
||||
}
|
||||
}
|
||||
|
||||
void UEquipClothingRestriction::OnClothingUnequipped(const UClothingItemData* ClothingData)
|
||||
void UEquipClothingRestriction::OnClothingUnequipped(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
const bool IsTargetClothing = ClothingItems.FindByPredicate([&ClothingData](const UClothingItem* Item)
|
||||
const bool IsTargetClothing = ClothingItems.FindByPredicate([&ClothingItemInstance](const UClothingItem* Item)
|
||||
{
|
||||
return Item && Item->Name.EqualTo(ClothingData->Info->Name);
|
||||
return Item && Item->Name.EqualTo(ClothingItemInstance->GetClothingItem()->Name);
|
||||
}) != nullptr;
|
||||
if (IsTargetClothing)
|
||||
{
|
||||
@@ -92,14 +91,14 @@ void UEquipClothingRestriction::CheckClothing()
|
||||
{
|
||||
for (const FClothingSlotData& ClothingSlot : Player->ClothingManager->ClothingSlots)
|
||||
{
|
||||
if (!ClothingSlot.ClothingData)
|
||||
if (!ClothingSlot.ClothingItemInstance)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const bool IsTargetClothing = ClothingItems.FindByPredicate([&ClothingSlot](const UClothingItem* Item)
|
||||
{
|
||||
return Item && Item->Name.EqualTo(ClothingSlot.ClothingData->Info->Name);
|
||||
return Item && Item->Name.EqualTo(ClothingSlot.ClothingItemInstance->GetClothingItem()->Name);
|
||||
}) != nullptr;
|
||||
if (IsTargetClothing)
|
||||
{
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
#include "NakedDesire/MissionBuilder/GoalRestriction.h"
|
||||
#include "EquipClothingRestriction.generated.h"
|
||||
|
||||
class UClothingItemInstance;
|
||||
class UClothingItem;
|
||||
class UClothingItemData;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
UCLASS(EditInlineNew)
|
||||
class NAKEDDESIRE_API UEquipClothingRestriction : public UGoalRestriction
|
||||
{
|
||||
@@ -30,10 +28,10 @@ private:
|
||||
FDelegateHandle ClothingUnequippedDelegateHandle;
|
||||
|
||||
UFUNCTION()
|
||||
void OnClothingEquipped(const UClothingItemData* ClothingData);
|
||||
void OnClothingEquipped(const UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
UFUNCTION()
|
||||
void OnClothingUnequipped(const UClothingItemData* ClothingData);
|
||||
void OnClothingUnequipped(const UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
void CheckClothing();
|
||||
};
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
#include "ExposeBodyPartRestriction.h"
|
||||
|
||||
#include "NakedDesire/Clothing/ClothingItemData.h"
|
||||
#include "NakedDesire/Clothing/ClothingItem.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemInstance.h"
|
||||
#include "NakedDesire/Player/NakedDesireCharacter.h"
|
||||
#include "NakedDesire/Clothing/ClothingManager.h"
|
||||
|
||||
@@ -40,20 +41,18 @@ FText UExposeBodyPartRestriction::GetDescription() const
|
||||
});
|
||||
}
|
||||
|
||||
void UExposeBodyPartRestriction::EquipClothing(const UClothingItemData* ClothingData)
|
||||
void UExposeBodyPartRestriction::EquipClothing(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
if (IsSuccess && ClothingData->Info->CoveredBodyParts.Contains(BodyPart))
|
||||
if (IsSuccess && ClothingItemInstance->GetClothingItem()->CoveredBodyParts.Contains(BodyPart))
|
||||
{
|
||||
Init(Player);
|
||||
}
|
||||
}
|
||||
|
||||
void UExposeBodyPartRestriction::UnequipClothing(const UClothingItemData* ClothingData)
|
||||
void UExposeBodyPartRestriction::UnequipClothing(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
if (IsSuccess)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CheckClothing();
|
||||
}
|
||||
@@ -67,9 +66,9 @@ void UExposeBodyPartRestriction::CheckClothing()
|
||||
|
||||
const FClothingSlotData* TargetClothingItem = Player->ClothingManager->ClothingSlots.FindByPredicate([this](const FClothingSlotData& ClothingSlot)
|
||||
{
|
||||
if (ClothingSlot.ClothingData)
|
||||
if (ClothingSlot.ClothingItemInstance)
|
||||
{
|
||||
return ClothingSlot.ClothingData->Info->CoveredBodyParts.Contains(BodyPart);
|
||||
return ClothingSlot.ClothingItemInstance->GetClothingItem()->CoveredBodyParts.Contains(BodyPart);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -7,10 +7,8 @@
|
||||
#include "NakedDesire/MissionBuilder/GoalRestriction.h"
|
||||
#include "ExposeBodyPartRestriction.generated.h"
|
||||
|
||||
class UClothingItemData;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class UClothingItemInstance;
|
||||
|
||||
UCLASS(EditInlineNew)
|
||||
class NAKEDDESIRE_API UExposeBodyPartRestriction : public UGoalRestriction
|
||||
{
|
||||
@@ -29,10 +27,10 @@ protected:
|
||||
|
||||
private:
|
||||
UFUNCTION()
|
||||
void EquipClothing(const UClothingItemData* ClothingData);
|
||||
void EquipClothing(const UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
UFUNCTION()
|
||||
void UnequipClothing(const UClothingItemData* ClothingData);
|
||||
void UnequipClothing(const UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
void CheckClothing();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user