Added ClothingItemInstance and cleanup the project
This commit is contained in:
@@ -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,13 +150,12 @@ public:
|
||||
UFUNCTION(BlueprintPure)
|
||||
EStance GetStance() const;
|
||||
|
||||
protected:
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
|
||||
virtual void NotifyControllerChanged() override;
|
||||
virtual void BeginPlay() override;
|
||||
virtual UAISense_Sight::EVisibilityResult CanBeSeenFrom(const FCanBeSeenFromContext& Context, FVector& OutSeenLocation, int32& OutNumberOfLoSChecksPerformed, int32& OutNumberOfAsyncLosCheckRequested, float& OutSightStrength, int32* UserData = nullptr, const FOnPendingVisibilityQueryProcessedDelegate* Delegate = nullptr) override;
|
||||
|
||||
|
||||
private:
|
||||
EGait Gait = EGait::Walk;
|
||||
EStance Stance = EStance::Stand;
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user