Added ClothingItemInstance and cleanup the project
This commit is contained in:
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,25 +0,0 @@
|
||||
// © 2025 Naked People Team. All Rights Reserved.
|
||||
|
||||
|
||||
#include "ClothingItemData.h"
|
||||
#include "../SaveGame/ClothingItemSaveData.h"
|
||||
|
||||
FClothingItemSaveData UClothingItemData::ToSaveData() const
|
||||
{
|
||||
FClothingItemSaveData SaveData;
|
||||
|
||||
SaveData.ClothingItem = Info;
|
||||
|
||||
return SaveData;
|
||||
}
|
||||
|
||||
UClothingItemData* UClothingItemData::CreateFromSaveData(const FClothingItemSaveData& SaveData)
|
||||
{
|
||||
|
||||
UClothingItem* ClothingItem = SaveData.ClothingItem.LoadSynchronous();
|
||||
|
||||
UClothingItemData* ClothingItemData = NewObject<UClothingItemData>();
|
||||
ClothingItemData->Info = ClothingItem;
|
||||
|
||||
return ClothingItemData;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
// © 2025 Naked People Team. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ClothingItem.h"
|
||||
#include "ClothingItemData.generated.h"
|
||||
|
||||
struct FClothingItemSaveData;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS(EditInlineNew, BlueprintType)
|
||||
class NAKEDDESIRE_API UClothingItemData : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(BlueprintReadOnly, EditDefaultsOnly)
|
||||
UClothingItem* Info = nullptr;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
FClothingItemSaveData ToSaveData() const;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
static UClothingItemData* CreateFromSaveData(const FClothingItemSaveData& SaveData);
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "ClothingItemInstance.h"
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "NakedDesire/Items/ItemInstance.h"
|
||||
#include "ClothingItemInstance.generated.h"
|
||||
|
||||
class UClothingItem;
|
||||
|
||||
UCLASS(BlueprintType)
|
||||
class NAKEDDESIRE_API UClothingItemInstance : public UItemInstance
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Clothing Item")
|
||||
float Condition = 1.0f;
|
||||
|
||||
UClothingItem* GetClothingItem() const { return ClothingItem; }
|
||||
|
||||
protected:
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Clothing Item")
|
||||
TObjectPtr<UClothingItem> ClothingItem;
|
||||
};
|
||||
@@ -1,5 +0,0 @@
|
||||
// © 2025 Naked People Team. All Rights Reserved.
|
||||
|
||||
|
||||
#include "ClothingList.h"
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
// © 2025 Naked People Team. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/DataAsset.h"
|
||||
#include "ClothingList.generated.h"
|
||||
|
||||
class UClothingItemData;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class NAKEDDESIRE_API UClothingList : public UPrimaryDataAsset
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Instanced)
|
||||
TArray<UClothingItemData*> ClothingItems;
|
||||
};
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
|
||||
#include "ClothingManager.h"
|
||||
#include "ClothingItemData.h"
|
||||
#include "ClothingItem.h"
|
||||
#include "ClothingItemInstance.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "NakedDesire/SaveGame/GlobalSaveGameData.h"
|
||||
|
||||
UClothingManager::UClothingManager()
|
||||
{
|
||||
@@ -15,7 +15,7 @@ bool UClothingManager::IsBodyTypeExposed(const EPrivateBodyPartType PrivateBodyP
|
||||
{
|
||||
for (const auto& ClothingSlot : ClothingSlots)
|
||||
{
|
||||
if (ClothingSlot.ClothingData && ClothingSlot.ClothingData->Info->CoveredBodyParts.Contains(PrivateBodyPartType))
|
||||
if (ClothingSlot.ClothingItemInstance && ClothingSlot.ClothingItemInstance->GetClothingItem()->CoveredBodyParts.Contains(PrivateBodyPartType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -37,26 +37,26 @@ bool UClothingManager::GetClothingSlotData(const EClothingSlotType ClothingSlotT
|
||||
|
||||
return false;
|
||||
}
|
||||
void UClothingManager::SetClothingSlotItem(const EClothingSlotType ClothingSlotType, UClothingItemData* ClothingItem)
|
||||
void UClothingManager::SetClothingSlotItem(const EClothingSlotType ClothingSlotType, UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
for (FClothingSlotData& ClothingSlot : ClothingSlots)
|
||||
{
|
||||
if (ClothingSlot.ClothingSlotType == ClothingSlotType)
|
||||
{
|
||||
ClothingSlot.ClothingData = ClothingItem;
|
||||
ClothingSlot.ClothingItemInstance = ClothingItemInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TArray<UClothingItemData*> UClothingManager::GetEquippedClothing()
|
||||
TArray<UClothingItemInstance*> UClothingManager::GetEquippedClothing()
|
||||
{
|
||||
TArray<UClothingItemData*> EquippedClothingItems;
|
||||
TArray<UClothingItemInstance*> EquippedClothingItems;
|
||||
|
||||
for (FClothingSlotData ClothingSlot : ClothingSlots)
|
||||
{
|
||||
if (ClothingSlot.ClothingData)
|
||||
if (ClothingSlot.ClothingItemInstance)
|
||||
{
|
||||
EquippedClothingItems.Add(ClothingSlot.ClothingData);
|
||||
EquippedClothingItems.Add(ClothingSlot.ClothingItemInstance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,110 +65,101 @@ TArray<UClothingItemData*> UClothingManager::GetEquippedClothing()
|
||||
|
||||
void UClothingManager::HydrateClothing(UGlobalSaveGameData* SaveGameData)
|
||||
{
|
||||
for (const FClothingItemSaveData& ClothingItemSaveData : SaveGameData->PlayerClothing)
|
||||
{
|
||||
UClothingItemData* ClothingItemData = UClothingItemData::CreateFromSaveData(ClothingItemSaveData);
|
||||
PutOnClothing(ClothingItemData);
|
||||
}
|
||||
// for (const FClothingItemSaveData& ClothingItemSaveData : SaveGameData->PlayerClothing)
|
||||
// {
|
||||
// UClothingItemData* ClothingItemData = UClothingItemData::CreateFromSaveData(ClothingItemSaveData);
|
||||
// PutOnClothing(ClothingItemData);
|
||||
// }
|
||||
}
|
||||
|
||||
float UClothingManager::GetHeelHeight()
|
||||
{
|
||||
if (FClothingSlotData ClothingSlotData; GetClothingSlotData(EClothingSlotType::Shoes, ClothingSlotData))
|
||||
{
|
||||
if (ClothingSlotData.ClothingData)
|
||||
if (ClothingSlotData.ClothingItemInstance)
|
||||
{
|
||||
return ClothingSlotData.ClothingData->Info->ShoesOffset;
|
||||
return ClothingSlotData.ClothingItemInstance->GetClothingItem()->ShoesOffset;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void UClothingManager::PutOnClothing(UClothingItemData* ClothingData)
|
||||
void UClothingManager::PutOnClothing(UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
if (!ClothingData)
|
||||
{
|
||||
if (!ClothingItemInstance)
|
||||
return;
|
||||
}
|
||||
|
||||
const EClothingSlotType ClothingSlotType = ClothingData->Info->SlotType;
|
||||
const EClothingSlotType ClothingSlotType = ClothingItemInstance->GetClothingItem()->SlotType;
|
||||
|
||||
FClothingSlotData ClothingSlotData;
|
||||
GetClothingSlotData(ClothingSlotType, ClothingSlotData);
|
||||
|
||||
ClothingSlotData.MeshComponent->SetSkeletalMesh(ClothingData->Info->SkeletalMesh);
|
||||
if (!ClothingData->Info->Materials.IsEmpty())
|
||||
ClothingSlotData.MeshComponent->SetSkeletalMesh(ClothingItemInstance->GetClothingItem()->SkeletalMesh);
|
||||
if (!ClothingItemInstance->GetClothingItem()->Materials.IsEmpty())
|
||||
{
|
||||
for (const TPair<FName, UMaterialInstance*>& Material : ClothingData->Info->Materials)
|
||||
for (const TPair<FName, UMaterialInstance*>& Material : ClothingItemInstance->GetClothingItem()->Materials)
|
||||
{
|
||||
ClothingSlotData.MeshComponent->SetMaterialByName(Material.Key, Material.Value);
|
||||
}
|
||||
}
|
||||
|
||||
SetClothingSlotItem(ClothingSlotType, ClothingData);
|
||||
if (ClothingData->Info->UseLeaderPose)
|
||||
SetClothingSlotItem(ClothingSlotType, ClothingItemInstance);
|
||||
if (ClothingItemInstance->GetClothingItem()->UseLeaderPose)
|
||||
{
|
||||
ClothingSlotData.MeshComponent->SetLeaderPoseComponent(Cast<ACharacter>(GetOwner())->GetMesh());
|
||||
}
|
||||
|
||||
OnClothingEquip.Broadcast(ClothingData);
|
||||
OnClothingEquip.Broadcast(ClothingItemInstance);
|
||||
}
|
||||
|
||||
void UClothingManager::TakeClothing(UClothingItemData* ClothingData)
|
||||
void UClothingManager::TakeClothing(UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
if (!ClothingData->Info)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FClothingSlotData ClothingSlotData;
|
||||
GetClothingSlotData(ClothingData->Info->SlotType, ClothingSlotData);
|
||||
GetClothingSlotData(ClothingItemInstance->GetClothingItem()->SlotType, ClothingSlotData);
|
||||
|
||||
if (ClothingSlotData.ClothingData->Info)
|
||||
if (ClothingSlotData.ClothingItemInstance->GetClothingItem())
|
||||
{
|
||||
DropClothing(ClothingData->Info->SlotType);
|
||||
DropClothing(ClothingItemInstance->GetClothingItem()->SlotType);
|
||||
}
|
||||
|
||||
ClothingSlotData.ClothingData = ClothingData;
|
||||
ClothingSlotData.ClothingItemInstance = ClothingItemInstance;
|
||||
|
||||
PutOnClothing(ClothingData);
|
||||
PutOnClothing(ClothingItemInstance);
|
||||
}
|
||||
|
||||
UClothingItemData* UClothingManager::RemoveClothing(const EClothingSlotType ClothingSlotType)
|
||||
UClothingItemInstance* UClothingManager::RemoveClothing(const EClothingSlotType ClothingSlotType)
|
||||
{
|
||||
FClothingSlotData ClothingSlotData;
|
||||
if (!GetClothingSlotData(ClothingSlotType, ClothingSlotData) || !ClothingSlotData.ClothingData)
|
||||
if (!GetClothingSlotData(ClothingSlotType, ClothingSlotData) || !ClothingSlotData.ClothingItemInstance)
|
||||
{
|
||||
UE_LOG(LogTemp, Error, TEXT("Couldn't find clothing slot"));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UClothingItemData* ClothingData = ClothingSlotData.ClothingData;
|
||||
UClothingItemInstance* ClothingItemInstance = ClothingSlotData.ClothingItemInstance;
|
||||
SetClothingSlotItem(ClothingSlotType, nullptr);
|
||||
|
||||
USkeletalMeshComponent* MeshComponent = ClothingSlotData.MeshComponent;
|
||||
MeshComponent->SetSkeletalMesh(nullptr);
|
||||
|
||||
if (ClothingData->Info->UseLeaderPose)
|
||||
if (ClothingItemInstance->GetClothingItem()->UseLeaderPose)
|
||||
{
|
||||
ClothingSlotData.MeshComponent->SetLeaderPoseComponent(nullptr);
|
||||
}
|
||||
|
||||
OnClothingUnequip.Broadcast(ClothingData);
|
||||
OnClothingUnequip.Broadcast(ClothingItemInstance);
|
||||
|
||||
return ClothingData;
|
||||
return ClothingItemInstance;
|
||||
}
|
||||
|
||||
void UClothingManager::DropClothing(const EClothingSlotType ClothingType)
|
||||
{
|
||||
const UClothingItemData* ClothingData = RemoveClothing(ClothingType);
|
||||
if (!ClothingData)
|
||||
{
|
||||
const UClothingItemInstance* ClothingItemInstance = RemoveClothing(ClothingType);
|
||||
if (!ClothingItemInstance)
|
||||
return;
|
||||
}
|
||||
|
||||
OnClothingDropped.Broadcast(ClothingData);
|
||||
OnClothingDropped.Broadcast(ClothingItemInstance);
|
||||
}
|
||||
|
||||
bool UClothingManager::IsClothingTypeOn(const EClothingSlotType ClothingType)
|
||||
@@ -176,7 +167,7 @@ bool UClothingManager::IsClothingTypeOn(const EClothingSlotType ClothingType)
|
||||
FClothingSlotData ClothingSlotData;
|
||||
GetClothingSlotData(ClothingType, ClothingSlotData);
|
||||
|
||||
const bool IsTypeOn = ClothingSlotData.ClothingData != nullptr;
|
||||
const bool IsTypeOn = ClothingSlotData.ClothingItemInstance != nullptr;
|
||||
return IsTypeOn;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
class UGlobalSaveGameData;
|
||||
class AClothingPickup;
|
||||
class UClothingItemData;
|
||||
class UClothingItemInstance;
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnClothingChangeSignature, const UClothingItemData*, ClothingData);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnClothingChangeSignature, const UClothingItemInstance*, ClothingItemInstance);
|
||||
|
||||
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||||
class NAKEDDESIRE_API UClothingManager : public UActorComponent
|
||||
@@ -30,8 +30,6 @@ public:
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Clothing Manager|Clothing")
|
||||
TArray<FClothingSlotData> ClothingSlots;
|
||||
|
||||
|
||||
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FOnClothingChangeSignature OnClothingEquip;
|
||||
|
||||
@@ -43,7 +41,7 @@ public:
|
||||
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void PutOnClothing(UClothingItemData* ClothingData);
|
||||
void PutOnClothing(UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void DropClothing(const EClothingSlotType ClothingType);
|
||||
@@ -58,19 +56,19 @@ public:
|
||||
bool IsBodyTypeExposed(EPrivateBodyPartType PrivateBodyPartType);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void TakeClothing(UClothingItemData* ClothingData);
|
||||
void TakeClothing(UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
UClothingItemData* RemoveClothing(EClothingSlotType ClothingSlotType);
|
||||
UClothingItemInstance* RemoveClothing(EClothingSlotType ClothingSlotType);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
bool GetClothingSlotData(EClothingSlotType ClothingSlotType, FClothingSlotData& OutClothingSlotData);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetClothingSlotItem(const EClothingSlotType ClothingSlotType, UClothingItemData* ClothingItem);
|
||||
void SetClothingSlotItem(const EClothingSlotType ClothingSlotType, UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
TArray<UClothingItemData*> GetEquippedClothing();
|
||||
TArray<UClothingItemInstance*> GetEquippedClothing();
|
||||
|
||||
void HydrateClothing(UGlobalSaveGameData* SaveGameData);
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include "ClothingSlotType.h"
|
||||
#include "ClothingSlotData.generated.h"
|
||||
|
||||
class UClothingItemInstance;
|
||||
enum class EClothingSlotType : uint8;
|
||||
class UClothingItemData;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -18,26 +18,26 @@ struct NAKEDDESIRE_API FClothingSlotData
|
||||
GENERATED_BODY()
|
||||
|
||||
FClothingSlotData()
|
||||
: MeshComponent(nullptr), ClothingSlotType(EClothingSlotType::Anal), ClothingData(nullptr), Name(FText::GetEmpty())
|
||||
: MeshComponent(nullptr), ClothingSlotType(EClothingSlotType::Anal), ClothingItemInstance(nullptr), Name(FText::GetEmpty())
|
||||
{
|
||||
}
|
||||
|
||||
FClothingSlotData(USkeletalMeshComponent* MeshComponent, const EClothingSlotType ClothingSlotType, UClothingItemData* ClothingData, const FText& Name)
|
||||
FClothingSlotData(USkeletalMeshComponent* MeshComponent, const EClothingSlotType ClothingSlotType, UClothingItemInstance* ClothingItemInstance, const FText& Name)
|
||||
{
|
||||
this->MeshComponent = MeshComponent;
|
||||
this->ClothingSlotType = ClothingSlotType;
|
||||
this->ClothingData = ClothingData;
|
||||
this->ClothingItemInstance = ClothingItemInstance;
|
||||
this->Name = Name;
|
||||
}
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Clothing")
|
||||
USkeletalMeshComponent* MeshComponent = nullptr;
|
||||
TObjectPtr<USkeletalMeshComponent> MeshComponent = nullptr;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Clothing")
|
||||
EClothingSlotType ClothingSlotType = EClothingSlotType::Anal;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Clothing")
|
||||
UClothingItemData* ClothingData = nullptr;
|
||||
TObjectPtr<UClothingItemInstance> ClothingItemInstance = nullptr;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, Category = "Clothing")
|
||||
FText Name = FText::GetEmpty();
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UENUM(BlueprintType)
|
||||
enum class EClothingSlotType : uint8
|
||||
{
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
// © 2025 Naked People Team. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ClothingSlotWidgetData.generated.h"
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct NAKEDDESIRE_API FClothingSlotWidgetData
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
UTexture2D* PlaceholderIcon = nullptr;
|
||||
};
|
||||
@@ -3,14 +3,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ClothingSlotWidgetData.h"
|
||||
#include "ClothingSlotType.h"
|
||||
#include "Engine/DataAsset.h"
|
||||
#include "ClothingSlotWidgetsInfo.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct NAKEDDESIRE_API FClothingSlotWidgetData
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
UTexture2D* PlaceholderIcon = nullptr;
|
||||
};
|
||||
|
||||
UCLASS()
|
||||
class NAKEDDESIRE_API UClothingSlotInfo : public UPrimaryDataAsset
|
||||
{
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
#include "NakedDesireGameMode.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemData.h"
|
||||
#include "NakedDesire/Clothing/ClothingItem.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemInstance.h"
|
||||
#include "UObject/ConstructorHelpers.h"
|
||||
#include "NakedDesire/Interactables/Wardrobe.h"
|
||||
#include "NakedDesire/MissionBuilder/MissionsConfig.h"
|
||||
@@ -19,7 +20,7 @@ AWardrobe* ANakedDesireGameMode::GetWardrobe() const
|
||||
return Wardrobe;
|
||||
}
|
||||
|
||||
void ANakedDesireGameMode::BuyItem(UClothingItemData* ClothingItem)
|
||||
void ANakedDesireGameMode::BuyItem(UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
ANakedDesireCharacter* Player = Cast<ANakedDesireCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
|
||||
if (!Player)
|
||||
@@ -27,13 +28,13 @@ void ANakedDesireGameMode::BuyItem(UClothingItemData* ClothingItem)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Player->Money < ClothingItem->Info->BasePrice)
|
||||
if (Player->Money < ClothingItemInstance->GetClothingItem()->BasePrice)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player->Money -= ClothingItem->Info->BasePrice;
|
||||
Wardrobe->ClothingItems.Add(ClothingItem);
|
||||
Player->Money -= ClothingItemInstance->GetClothingItem()->BasePrice;
|
||||
Wardrobe->ClothingItems.Add(ClothingItemInstance);
|
||||
}
|
||||
|
||||
void ANakedDesireGameMode::OnHourChanged(int32 Hour)
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include "GameFramework/GameModeBase.h"
|
||||
#include "NakedDesireGameMode.generated.h"
|
||||
|
||||
class UClothingItemInstance;
|
||||
class UMissionsConfig;
|
||||
class AWardrobe;
|
||||
class UClothingItemData;
|
||||
|
||||
UCLASS(minimalapi)
|
||||
class ANakedDesireGameMode : public AGameModeBase
|
||||
@@ -26,8 +26,6 @@ class ANakedDesireGameMode : public AGameModeBase
|
||||
public:
|
||||
int NoticeCount = 0;
|
||||
|
||||
|
||||
|
||||
void RestartGame();
|
||||
|
||||
UFUNCTION(BlueprintPure, BlueprintImplementableEvent)
|
||||
@@ -46,7 +44,7 @@ public:
|
||||
void EndGameEmbarrassed();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void BuyItem(UClothingItemData* ClothingItem);
|
||||
void BuyItem(UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void OnHourChanged(int32 Hour);
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSettingsChanged, class UNakedDesireUserSettings*, Settings);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class NAKEDDESIRE_API UNakedDesireUserSettings : public UGameUserSettings
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "Wardrobe.generated.h"
|
||||
|
||||
class UClothingItemData;
|
||||
class UClothingItemInstance;
|
||||
|
||||
UCLASS(Blueprintable)
|
||||
class NAKEDDESIRE_API AWardrobe : public AInteractableBase
|
||||
@@ -16,5 +16,5 @@ class NAKEDDESIRE_API AWardrobe : public AInteractableBase
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced)
|
||||
TArray<UClothingItemData*> ClothingItems;
|
||||
TArray<TObjectPtr<UClothingItemInstance>> ClothingItems;
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "Internationalization/Text.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemData.h"
|
||||
#include "NakedDesire/Clothing/ClothingItem.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemInstance.h"
|
||||
#include "NakedDesire/Global/Constants.h"
|
||||
#include "NakedDesire/Global/NakedDesireUserSettings.h"
|
||||
#include "NakedDesire/SaveGame/GlobalSaveGameData.h"
|
||||
#include "Perception/AIPerceptionStimuliSourceComponent.h"
|
||||
#include "Perception/AISense_Sight.h"
|
||||
|
||||
@@ -152,12 +152,12 @@ void ANakedDesireCharacter::BeginPlay()
|
||||
StimuliSourceComponent->RegisterForSense(TSubclassOf<UAISense_Sight>());
|
||||
StimuliSourceComponent->RegisterWithPerceptionSystem();
|
||||
|
||||
UGlobalSaveGameData* SaveGameData = UGlobalSaveGameData::LoadOrCreateSaveGame(DefaultPlayerClothing, DefaultWardrobeClothing);
|
||||
// UGlobalSaveGameData* SaveGameData = UGlobalSaveGameData::LoadOrCreateSaveGame(DefaultPlayerClothing, DefaultWardrobeClothing);
|
||||
|
||||
if (SaveGameData)
|
||||
{
|
||||
Money = FMath::RoundToInt(SaveGameData->Money);
|
||||
}
|
||||
// if (SaveGameData)
|
||||
// {
|
||||
// Money = FMath::RoundToInt(SaveGameData->Money);
|
||||
// }
|
||||
|
||||
SetupClothingSlots();
|
||||
|
||||
@@ -166,7 +166,7 @@ void ANakedDesireCharacter::BeginPlay()
|
||||
|
||||
UNakedDesireUserSettings::GetNakedDesireUserSettings()->OnSettingsChanged.AddUniqueDynamic(this, &ANakedDesireCharacter::OnSettingsChanged);
|
||||
|
||||
ClothingManager->HydrateClothing(SaveGameData);
|
||||
// ClothingManager->HydrateClothing(SaveGameData);
|
||||
}
|
||||
|
||||
UAISense_Sight::EVisibilityResult ANakedDesireCharacter::CanBeSeenFrom(const FCanBeSeenFromContext& Context,
|
||||
@@ -257,29 +257,27 @@ void ANakedDesireCharacter::OnEndOverlap(UPrimitiveComponent* OverlappedComponen
|
||||
}
|
||||
}
|
||||
|
||||
void ANakedDesireCharacter::OnClothingEquip(const UClothingItemData* ClothingItemData)
|
||||
void ANakedDesireCharacter::OnClothingEquip(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
if (ClothingItemData->Info->CoveredBodyParts.Contains(EPrivateBodyPartType::BackBottom))
|
||||
if (ClothingItemInstance->GetClothingItem()->CoveredBodyParts.Contains(EPrivateBodyPartType::BackBottom))
|
||||
{
|
||||
BackBottomCensorship->SetVisibility(false);
|
||||
}
|
||||
if (ClothingItemData->Info->CoveredBodyParts.Contains(EPrivateBodyPartType::FrontBottom))
|
||||
if (ClothingItemInstance->GetClothingItem()->CoveredBodyParts.Contains(EPrivateBodyPartType::FrontBottom))
|
||||
{
|
||||
FrontBottomCensorship->SetVisibility(false);
|
||||
}
|
||||
if (ClothingItemData->Info->CoveredBodyParts.Contains(EPrivateBodyPartType::FrontTop))
|
||||
if (ClothingItemInstance->GetClothingItem()->CoveredBodyParts.Contains(EPrivateBodyPartType::FrontTop))
|
||||
{
|
||||
BoobLCensorship->SetVisibility(false);
|
||||
BoobRCensorship->SetVisibility(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ANakedDesireCharacter::OnClothingUnequip(const UClothingItemData* ClothingItemData)
|
||||
void ANakedDesireCharacter::OnClothingUnequip(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
if (!UNakedDesireUserSettings::GetNakedDesireUserSettings()->GetIsCensorshipEnabled() && !IS_DEMO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ClothingManager->IsBodyTypeExposed(EPrivateBodyPartType::BackBottom))
|
||||
{
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "NakedDesireCharacter.generated.h"
|
||||
|
||||
class UAIPerceptionStimuliSourceComponent;
|
||||
class UClothingItemData;
|
||||
class UClothingList;
|
||||
struct FClothingSlotData;
|
||||
class UInteractionManager;
|
||||
@@ -52,12 +51,6 @@ public:
|
||||
UInputAction* CrouchAction;
|
||||
|
||||
// Clothing
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Clothing Manager|Clothing")
|
||||
UClothingList* DefaultPlayerClothing = nullptr;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Clothing Manager|Clothing")
|
||||
UClothingList* DefaultWardrobeClothing = nullptr;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Clothing")
|
||||
USkeletalMeshComponent* NipplesMeshComponent;
|
||||
|
||||
@@ -157,7 +150,6 @@ public:
|
||||
UFUNCTION(BlueprintPure)
|
||||
EStance GetStance() const;
|
||||
|
||||
protected:
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
|
||||
virtual void NotifyControllerChanged() override;
|
||||
@@ -177,10 +169,10 @@ private:
|
||||
int32 OtherBodyIndex);
|
||||
|
||||
UFUNCTION()
|
||||
void OnClothingEquip(const UClothingItemData* ClothingItemData);
|
||||
void OnClothingEquip(const UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
UFUNCTION()
|
||||
void OnClothingUnequip(const UClothingItemData* ClothingItemData);
|
||||
void OnClothingUnequip(const UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
UFUNCTION()
|
||||
void OnSettingsChanged(UNakedDesireUserSettings* Settings);
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "PlayerCinematic.h"
|
||||
|
||||
#include "PlayerCinematic.h"
|
||||
#include "NakedDesireCharacter.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemData.h"
|
||||
#include "NakedDesire/Clothing/ClothingItem.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemInstance.h"
|
||||
#include "NakedDesire/Clothing/ClothingManager.h"
|
||||
|
||||
|
||||
@@ -57,20 +54,20 @@ void APlayerCinematic::BeginPlay()
|
||||
Player->ClothingManager->OnClothingEquip.AddUniqueDynamic(this, &APlayerCinematic::OnClothingEquip);
|
||||
Player->ClothingManager->OnClothingUnequip.AddUniqueDynamic(this, &APlayerCinematic::OnClothingUnequip);
|
||||
|
||||
for (const UClothingItemData* ClothingItemData : Player->ClothingManager->GetEquippedClothing())
|
||||
for (const UClothingItemInstance* ClothingItemInstance : Player->ClothingManager->GetEquippedClothing())
|
||||
{
|
||||
EquipClothing(ClothingItemData);
|
||||
EquipClothing(ClothingItemInstance);
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCinematic::OnClothingEquip(const UClothingItemData* ClothingData)
|
||||
void APlayerCinematic::OnClothingEquip(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
EquipClothing(ClothingData);
|
||||
EquipClothing(ClothingItemInstance);
|
||||
}
|
||||
|
||||
void APlayerCinematic::OnClothingUnequip(const UClothingItemData* ClothingData)
|
||||
void APlayerCinematic::OnClothingUnequip(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
UnequipClothing(ClothingData);
|
||||
UnequipClothing(ClothingItemInstance);
|
||||
}
|
||||
|
||||
USkeletalMeshComponent* APlayerCinematic::GetMeshByType(const EClothingSlotType SlotType) const
|
||||
@@ -110,27 +107,27 @@ USkeletalMeshComponent* APlayerCinematic::GetMeshByType(const EClothingSlotType
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCinematic::EquipClothing(const UClothingItemData* ClothingData)
|
||||
void APlayerCinematic::EquipClothing(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingData->Info->SlotType);
|
||||
MeshComponent->SetSkeletalMesh(ClothingData->Info->SkeletalMesh);
|
||||
if (ClothingData->Info->UseLeaderPose)
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingItemInstance->GetClothingItem()->SlotType);
|
||||
MeshComponent->SetSkeletalMesh(ClothingItemInstance->GetClothingItem()->SkeletalMesh);
|
||||
if (ClothingItemInstance->GetClothingItem()->UseLeaderPose)
|
||||
{
|
||||
MeshComponent->SetLeaderPoseComponent(GetMesh());
|
||||
}
|
||||
|
||||
if (!ClothingData->Info->Materials.IsEmpty())
|
||||
if (!ClothingItemInstance->GetClothingItem()->Materials.IsEmpty())
|
||||
{
|
||||
for (const TPair<FName, UMaterialInstance*>& Material : ClothingData->Info->Materials)
|
||||
for (const TPair<FName, UMaterialInstance*>& Material : ClothingItemInstance->GetClothingItem()->Materials)
|
||||
{
|
||||
MeshComponent->SetMaterialByName(Material.Key, Material.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCinematic::UnequipClothing(const UClothingItemData* ClothingData)
|
||||
void APlayerCinematic::UnequipClothing(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingData->Info->SlotType);
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingItemInstance->GetClothingItem()->SlotType);
|
||||
MeshComponent->SetSkeletalMesh(nullptr);
|
||||
MeshComponent->SetLeaderPoseComponent(nullptr);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "NakedDesire/Clothing/ClothingSlotType.h"
|
||||
#include "PlayerCinematic.generated.h"
|
||||
|
||||
class UClothingItemData;
|
||||
class UClothingItemInstance;
|
||||
class ANakedDesireCharacter;
|
||||
|
||||
UCLASS()
|
||||
@@ -68,12 +66,12 @@ protected:
|
||||
|
||||
private:
|
||||
UFUNCTION()
|
||||
void OnClothingEquip(const UClothingItemData* ClothingData);
|
||||
void OnClothingEquip(const UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
UFUNCTION()
|
||||
void OnClothingUnequip(const UClothingItemData* ClothingData);
|
||||
void OnClothingUnequip(const UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
USkeletalMeshComponent* GetMeshByType(const EClothingSlotType SlotType) const;
|
||||
void EquipClothing(const UClothingItemData* ClothingData);
|
||||
void UnequipClothing(const UClothingItemData* ClothingData);
|
||||
void EquipClothing(const UClothingItemInstance* ClothingItemInstance);
|
||||
void UnequipClothing(const UClothingItemInstance* ClothingItemInstance);
|
||||
};
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "PlayerImpostor.h"
|
||||
|
||||
#include "PlayerImpostor.h"
|
||||
#include "NakedDesireCharacter.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NakedDesire/Clothing/ClothingItem.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemInstance.h"
|
||||
#include "NakedDesire/Clothing/ClothingManager.h"
|
||||
|
||||
|
||||
@@ -48,14 +46,14 @@ APlayerImpostor::APlayerImpostor()
|
||||
ShoesMeshComponent->SetupAttachment(GetMesh());
|
||||
}
|
||||
|
||||
void APlayerImpostor::OnClothingEquip(const UClothingItemData* ClothingData)
|
||||
void APlayerImpostor::OnClothingEquip(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
EquipClothing(ClothingData);
|
||||
EquipClothing(ClothingItemInstance);
|
||||
}
|
||||
|
||||
void APlayerImpostor::OnClothingUnequip(const UClothingItemData* ClothingData)
|
||||
void APlayerImpostor::OnClothingUnequip(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
UnequipClothing(ClothingData);
|
||||
UnequipClothing(ClothingItemInstance);
|
||||
}
|
||||
|
||||
void APlayerImpostor::BeginPlay()
|
||||
@@ -71,9 +69,9 @@ void APlayerImpostor::BeginPlay()
|
||||
Player->ClothingManager->OnClothingEquip.AddUniqueDynamic(this, &APlayerImpostor::OnClothingEquip);
|
||||
Player->ClothingManager->OnClothingUnequip.AddUniqueDynamic(this, &APlayerImpostor::OnClothingUnequip);
|
||||
|
||||
for (const UClothingItemData* ClothingItemData : Player->ClothingManager->GetEquippedClothing())
|
||||
for (const UClothingItemInstance* ClothingItemInstance : Player->ClothingManager->GetEquippedClothing())
|
||||
{
|
||||
EquipClothing(ClothingItemData);
|
||||
EquipClothing(ClothingItemInstance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,27 +112,27 @@ USkeletalMeshComponent* APlayerImpostor::GetMeshByType(const EClothingSlotType S
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerImpostor::EquipClothing(const UClothingItemData* ClothingData)
|
||||
void APlayerImpostor::EquipClothing(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingData->Info->SlotType);
|
||||
MeshComponent->SetSkeletalMesh(ClothingData->Info->SkeletalMesh);
|
||||
if (ClothingData->Info->UseLeaderPose)
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingItemInstance->GetClothingItem()->SlotType);
|
||||
MeshComponent->SetSkeletalMesh(ClothingItemInstance->GetClothingItem()->SkeletalMesh);
|
||||
if (ClothingItemInstance->GetClothingItem()->UseLeaderPose)
|
||||
{
|
||||
MeshComponent->SetLeaderPoseComponent(GetMesh());
|
||||
}
|
||||
|
||||
if (!ClothingData->Info->Materials.IsEmpty())
|
||||
if (!ClothingItemInstance->GetClothingItem()->Materials.IsEmpty())
|
||||
{
|
||||
for (const TPair<FName, UMaterialInstance*>& Material : ClothingData->Info->Materials)
|
||||
for (const TPair<FName, UMaterialInstance*>& Material : ClothingItemInstance->GetClothingItem()->Materials)
|
||||
{
|
||||
MeshComponent->SetMaterialByName(Material.Key, Material.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerImpostor::UnequipClothing(const UClothingItemData* ClothingData)
|
||||
void APlayerImpostor::UnequipClothing(const UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingData->Info->SlotType);
|
||||
USkeletalMeshComponent* MeshComponent = GetMeshByType(ClothingItemInstance->GetClothingItem()->SlotType);
|
||||
MeshComponent->SetSkeletalMesh(nullptr);
|
||||
MeshComponent->SetLeaderPoseComponent(nullptr);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemData.h"
|
||||
#include "NakedDesire/Clothing/ClothingSlotType.h"
|
||||
#include "PlayerImpostor.generated.h"
|
||||
|
||||
class UClothingItemInstance;
|
||||
class ANakedDesireCharacter;
|
||||
|
||||
UCLASS()
|
||||
@@ -69,18 +67,17 @@ class NAKEDDESIRE_API APlayerImpostor : public APawn
|
||||
public:
|
||||
APlayerImpostor();
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
private:
|
||||
UFUNCTION()
|
||||
void OnClothingEquip(const UClothingItemData* ClothingData);
|
||||
void OnClothingEquip(const UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
UFUNCTION()
|
||||
void OnClothingUnequip(const UClothingItemData* ClothingData);
|
||||
void OnClothingUnequip(const UClothingItemInstance* ClothingItemInstance);
|
||||
|
||||
USkeletalMeshComponent* GetMesh() const { return Mesh; };
|
||||
USkeletalMeshComponent* GetMeshByType(const EClothingSlotType SlotType) const;
|
||||
void EquipClothing(const UClothingItemData* ClothingData);
|
||||
void UnequipClothing(const UClothingItemData* ClothingData);
|
||||
void EquipClothing(const UClothingItemInstance* ClothingItemInstance);
|
||||
void UnequipClothing(const UClothingItemInstance* ClothingItemInstance);
|
||||
};
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
// © 2025 Naked People Team. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/Object.h"
|
||||
#include "ClothingItemSaveData.generated.h"
|
||||
|
||||
class UClothingItem;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
USTRUCT(BlueprintType)
|
||||
struct FClothingItemSaveData
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY()
|
||||
TSoftObjectPtr<UClothingItem> ClothingItem;
|
||||
};
|
||||
@@ -2,13 +2,10 @@
|
||||
|
||||
|
||||
#include "GlobalSaveGameData.h"
|
||||
|
||||
#include "NakedDesire/Global/Constants.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemData.h"
|
||||
#include "NakedDesire/Clothing/ClothingList.h"
|
||||
|
||||
UGlobalSaveGameData* UGlobalSaveGameData::CreateNewSaveGame(TArray<UClothingItemData*> CurrentWardrobeClothing, TArray<UClothingItemData*> CurrentPlayerClothing, float InMoney)
|
||||
UGlobalSaveGameData* UGlobalSaveGameData::CreateNewSaveGame()
|
||||
{
|
||||
UGlobalSaveGameData* NewSave = Cast<UGlobalSaveGameData>(
|
||||
UGameplayStatics::CreateSaveGameObject(UGlobalSaveGameData::StaticClass())
|
||||
@@ -19,22 +16,22 @@ UGlobalSaveGameData* UGlobalSaveGameData::CreateNewSaveGame(TArray<UClothingItem
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NewSave->Money = InMoney;
|
||||
// NewSave->Money = InMoney;
|
||||
|
||||
for (const UClothingItemData* Item : CurrentWardrobeClothing)
|
||||
{
|
||||
NewSave->WardrobeClothing.Add(Item->ToSaveData());
|
||||
}
|
||||
|
||||
for (const UClothingItemData* Item : CurrentPlayerClothing)
|
||||
{
|
||||
NewSave->PlayerClothing.Add(Item->ToSaveData());
|
||||
}
|
||||
// for (const UClothingItemData* Item : CurrentWardrobeClothing)
|
||||
// {
|
||||
// NewSave->WardrobeClothing.Add(Item->ToSaveData());
|
||||
// }
|
||||
//
|
||||
// for (const UClothingItemData* Item : CurrentPlayerClothing)
|
||||
// {
|
||||
// NewSave->PlayerClothing.Add(Item->ToSaveData());
|
||||
// }
|
||||
|
||||
return NewSave;
|
||||
}
|
||||
|
||||
UGlobalSaveGameData* UGlobalSaveGameData::LoadOrCreateSaveGame(UClothingList* DefaultPlayerClothing, UClothingList* DefaultWardrobeClothing)
|
||||
UGlobalSaveGameData* UGlobalSaveGameData::LoadOrCreateSaveGame()
|
||||
{
|
||||
if (UGameplayStatics::DoesSaveGameExist(SLOT_NAME, SLOT_PLAYER))
|
||||
{
|
||||
@@ -44,10 +41,10 @@ UGlobalSaveGameData* UGlobalSaveGameData::LoadOrCreateSaveGame(UClothingList* De
|
||||
}
|
||||
|
||||
UGlobalSaveGameData* NewSave = nullptr;
|
||||
if (DefaultWardrobeClothing && DefaultPlayerClothing)
|
||||
{
|
||||
NewSave = CreateNewSaveGame(DefaultWardrobeClothing->ClothingItems, DefaultPlayerClothing->ClothingItems, STARTING_MONEY);
|
||||
}
|
||||
// if (DefaultWardrobeClothing && DefaultPlayerClothing)
|
||||
// {
|
||||
// NewSave = CreateNewSaveGame(DefaultWardrobeClothing->ClothingItems, DefaultPlayerClothing->ClothingItems, STARTING_MONEY);
|
||||
// }
|
||||
|
||||
if (NewSave)
|
||||
{
|
||||
@@ -57,13 +54,12 @@ UGlobalSaveGameData* UGlobalSaveGameData::LoadOrCreateSaveGame(UClothingList* De
|
||||
return NewSave;
|
||||
}
|
||||
|
||||
bool UGlobalSaveGameData::SaveGame(const TArray<UClothingItemData*> CurrentWardrobeClothing,
|
||||
const TArray<UClothingItemData*> CurrentPlayerClothing, int32 InMoney)
|
||||
bool UGlobalSaveGameData::SaveGame()
|
||||
{
|
||||
if (UGlobalSaveGameData* Save = CreateNewSaveGame(CurrentWardrobeClothing, CurrentPlayerClothing, (float)InMoney))
|
||||
{
|
||||
return UGameplayStatics::SaveGameToSlot(Save, SLOT_NAME, SLOT_PLAYER);
|
||||
}
|
||||
// if (UGlobalSaveGameData* Save = CreateNewSaveGame(CurrentWardrobeClothing, CurrentPlayerClothing, (float)InMoney))
|
||||
// {
|
||||
// return UGameplayStatics::SaveGameToSlot(Save, SLOT_NAME, SLOT_PLAYER);
|
||||
// }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3,15 +3,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ClothingItemSaveData.h"
|
||||
#include "GameFramework/SaveGame.h"
|
||||
#include "GlobalSaveGameData.generated.h"
|
||||
|
||||
class UClothingList;
|
||||
class UClothingItemData;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
UCLASS()
|
||||
class NAKEDDESIRE_API UGlobalSaveGameData : public USaveGame
|
||||
{
|
||||
@@ -24,18 +20,12 @@ public:
|
||||
UPROPERTY(BlueprintReadWrite, SaveGame)
|
||||
float Money = 0;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
TArray<FClothingItemSaveData> WardrobeClothing;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite)
|
||||
TArray<FClothingItemSaveData> PlayerClothing;
|
||||
UFUNCTION(BlueprintCallable)
|
||||
static UGlobalSaveGameData* LoadOrCreateSaveGame();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
static UGlobalSaveGameData* LoadOrCreateSaveGame(UClothingList* DefaultPlayerClothing, UClothingList* DefaultWardrobeClothing);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
static bool SaveGame(TArray<UClothingItemData*> CurrentWardrobeClothing, TArray<UClothingItemData*> CurrentPlayerClothing, int32 InMoney);
|
||||
static bool SaveGame();
|
||||
|
||||
private:
|
||||
static UGlobalSaveGameData* CreateNewSaveGame(TArray<UClothingItemData*> CurrentWardrobeClothing, TArray<UClothingItemData*> CurrentPlayerClothing, float InMoney);
|
||||
static UGlobalSaveGameData* CreateNewSaveGame();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user