vr bugs fixed
This commit is contained in:
@@ -1,27 +1,70 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "ResComApartmentManager.h"
|
||||
|
||||
// Sets default values
|
||||
AResComApartmentManager::AResComApartmentManager()
|
||||
UResComApartmentManager::UResComApartmentManager()
|
||||
{
|
||||
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AResComApartmentManager::BeginPlay()
|
||||
void UResComApartmentManager::Push(FApartment apartment)
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
apartments.Push(apartment);
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void AResComApartmentManager::Tick(float DeltaTime)
|
||||
void UResComApartmentManager::ClearFavorites()
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
|
||||
for (auto& ap : apartments)
|
||||
ap.favorite = false;
|
||||
}
|
||||
|
||||
bool UResComApartmentManager::IsValid(FApartment apartment) const
|
||||
{
|
||||
return !(apartment.id == FApartment().id);
|
||||
}
|
||||
|
||||
FApartment& UResComApartmentManager::GetByID(int32 id)
|
||||
{
|
||||
for (auto& ap : apartments)
|
||||
{
|
||||
if (ap.id == id)
|
||||
return ap;
|
||||
}
|
||||
return notValid;
|
||||
}
|
||||
|
||||
FApartment& UResComApartmentManager::GetByLoc(FApartmentLocation loc)
|
||||
{
|
||||
for (auto& ap : apartments)
|
||||
{
|
||||
if (ap.loc == loc)
|
||||
return ap;
|
||||
}
|
||||
return notValid;
|
||||
}
|
||||
|
||||
|
||||
TArray<FApartment> UResComApartmentManager::GetFavorites()
|
||||
{
|
||||
TArray<FApartment> favorites;
|
||||
for (auto& ap : apartments)
|
||||
if (ap.favorite)
|
||||
favorites.Push(ap);
|
||||
return favorites;
|
||||
}
|
||||
|
||||
void UResComApartmentManager::SortByLoc()
|
||||
{
|
||||
apartments.Sort([](const FApartment& apa1, const FApartment& apa2)
|
||||
{
|
||||
return apa1.loc.AsNum() > apa2.loc.AsNum();
|
||||
});
|
||||
}
|
||||
|
||||
void UResComApartmentManager::SortByID()
|
||||
{
|
||||
apartments.Sort([](const FApartment& apa1, const FApartment& apa2)
|
||||
{
|
||||
return apa1.id > apa2.id;
|
||||
});
|
||||
}
|
||||
+61
-4
@@ -1,10 +1,67 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "CppGameInstance.h"
|
||||
#include "ResComGameInstance.h"
|
||||
|
||||
UResComGameInstance::UResComGameInstance()
|
||||
{
|
||||
}
|
||||
|
||||
void UResComGameInstance::Init()
|
||||
{
|
||||
Super::Init();
|
||||
apartmentManager = NewObject<UResComApartmentManager>(this);
|
||||
}
|
||||
|
||||
//void UResComGameInstance::SetApartmentManager(UResComApartmentManager* manager)
|
||||
//{
|
||||
// apartmentManager = manager;
|
||||
//}
|
||||
|
||||
UResComApartmentManager* UResComGameInstance::GetApartmentManager() const
|
||||
{
|
||||
return apartmentManager;
|
||||
}
|
||||
|
||||
|
||||
//void UCppGameInstance::HttpGet(FString UrlAddress, const FHttpDelegate& Callback)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//void UResComGameInstance::HttpGet(FString UrlAddress, const FHttpDelegate& Callback)
|
||||
//{
|
||||
// /*TSharedRef<IHttpRequest, ESPMode::ThreadSafe> HttpRequest = FHttpModule::Get().CreateRequest();
|
||||
// HttpRequest->SetHeader("Content-Type", "application/json");
|
||||
@@ -33,7 +90,7 @@
|
||||
// //HttpDownloadRequest = &HttpRequest.Get();
|
||||
//}
|
||||
//
|
||||
//void UCppGameInstance::OnHttpRequestComplete(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
|
||||
//void UResComGameInstance::OnHttpRequestComplete(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
|
||||
//{
|
||||
// if (bWasSuccessful && Response->GetContentType() == "application/json")
|
||||
// {
|
||||
@@ -58,7 +115,7 @@
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//FString UCppGameInstance::GetHttpData()
|
||||
//FString UResComGameInstance::GetHttpData()
|
||||
//{
|
||||
// return HttpData;
|
||||
//}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "ResComPoint.h"
|
||||
|
||||
// Sets default values
|
||||
AResComPoint::AResComPoint()
|
||||
{
|
||||
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void AResComPoint::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
void AResComPoint::Tick(float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include "CppStruct_AnimModeDirection.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
//#include "CppEnums.h"
|
||||
#include "Animation/WidgetAnimation.h"
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ResComPoint.h"
|
||||
#include "Engine/Texture2DDynamic.h"
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
//#include "GameFramework/Actor.h"
|
||||
#include "ResComApartmentManager.generated.h"
|
||||
|
||||
|
||||
@@ -12,12 +14,16 @@ USTRUCT(BlueprintType)
|
||||
struct FApartmentLocation
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 locHouse = 0;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 locFloor = 0;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 locEntrance = 0;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 locFloor = 0;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 locApartment = 0;
|
||||
|
||||
@@ -25,24 +31,179 @@ struct FApartmentLocation
|
||||
{
|
||||
return (loc.locHouse == locHouse) && (loc.locFloor == locFloor) && (loc.locEntrance == locEntrance) && (loc.locApartment == locApartment);
|
||||
}
|
||||
|
||||
int32 AsNum() const
|
||||
{
|
||||
return (locHouse * 10000 + locEntrance * 1000 + locFloor * 100 + locApartment);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
UCLASS()
|
||||
class FORTIS_TAKTIKA_API AResComApartmentManager : public AActor
|
||||
USTRUCT(BlueprintType)
|
||||
struct FApartmentQuantities
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
AResComApartmentManager();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 rooms = 0;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 toilets = 0;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 bedrooms = 0;
|
||||
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum RoomType
|
||||
{
|
||||
room UMETA(DisplayName = "room"),
|
||||
bedroom UMETA(DisplayName = "bedroom"),
|
||||
toilet UMETA(DisplayName = "toilet"),
|
||||
bathroom UMETA(DisplayName = "bathroom"),
|
||||
wardrobe UMETA(DisplayName = "wardrobe"),
|
||||
hallway UMETA(DisplayName = "hallway"),
|
||||
balcony UMETA(DisplayName = "balcony"),
|
||||
kitchen UMETA(DisplayName = "kitchen"),
|
||||
livingRoom UMETA(DisplayName = "livingRoom"),
|
||||
kitchen_livingRoom UMETA(DisplayName = "kitchen_livingRoom"),
|
||||
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum ApartmentType
|
||||
{
|
||||
default UMETA(DisplayName = "default"),
|
||||
studio UMETA(DisplayName = "studio"),
|
||||
duplex UMETA(DisplayName = "duplex"),
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FRoomArea
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TEnumAsByte<RoomType> type = RoomType::room;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
float meters = 0.0f;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FApartmentAreas
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
float full = 0.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<FRoomArea> rooms;
|
||||
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FApartmentCosts
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
float full = 0.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
float month = 0.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
float meter = 0.0f;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FApartmentReferences
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<UTexture2DDynamic*> textures;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
AResComPoint* point = nullptr;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FApartment
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 id = -1;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FString nameRC;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FApartmentLocation loc;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
bool favorite = false;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TEnumAsByte<ApartmentType> type;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FApartmentReferences references;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FApartmentQuantities quantities;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FApartmentAreas areas;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FApartmentCosts costs;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<FString> properties;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FString description;
|
||||
};
|
||||
|
||||
UCLASS(BlueprintType)
|
||||
class FORTIS_TAKTIKA_API UResComApartmentManager : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
private:
|
||||
TArray<FApartment> apartments;
|
||||
FApartment notValid;
|
||||
public:
|
||||
UResComApartmentManager();
|
||||
|
||||
// valid
|
||||
UFUNCTION(BlueprintCallable = "valid")
|
||||
bool IsValid(FApartment apartment) const;
|
||||
|
||||
//modify
|
||||
UFUNCTION(BlueprintCallable = "modify")
|
||||
void Push(FApartment apartment);
|
||||
|
||||
UFUNCTION(BlueprintCallable = "modify")
|
||||
void ClearFavorites();
|
||||
|
||||
// get
|
||||
UFUNCTION(BlueprintCallable, Category = "get")
|
||||
FApartment& GetByID(int32 id);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "get")
|
||||
FApartment& GetByLoc(FApartmentLocation loc);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "get")
|
||||
TArray<FApartment> GetFavorites();
|
||||
|
||||
//sort
|
||||
UFUNCTION(BlueprintCallable, Category = "sort")
|
||||
void SortByLoc();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "sort")
|
||||
void SortByID();
|
||||
};
|
||||
|
||||
+14
-2
@@ -2,6 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ResComApartmentManager.h"
|
||||
#include "Engine/LatentActionManager.h"
|
||||
#include "Interfaces/IHttpRequest.h"
|
||||
#include "Runtime/Online/HTTP/Public/HttpModule.h"
|
||||
@@ -12,7 +13,7 @@
|
||||
#include "LatentActions.h"
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/GameInstance.h"
|
||||
#include "CppGameInstance.generated.h"
|
||||
#include "ResComGameInstance.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -21,13 +22,24 @@
|
||||
DECLARE_DYNAMIC_DELEGATE_OneParam(FHttpDelegate, FString, Content);
|
||||
|
||||
UCLASS()
|
||||
class FORTIS_TAKTIKA_API UCppGameInstance : public UGameInstance
|
||||
class FORTIS_TAKTIKA_API UResComGameInstance : public UGameInstance
|
||||
{
|
||||
GENERATED_BODY()
|
||||
private:
|
||||
UResComApartmentManager* apartmentManager;
|
||||
//FString HttpData;
|
||||
//FHttpDelegate& Callback;
|
||||
protected:
|
||||
//UFUNCTION(BlueprintCallable, Category = "ApartmentManager")
|
||||
//void SetApartmentManager(UResComApartmentManager* manager);
|
||||
public:
|
||||
UResComGameInstance();
|
||||
virtual void Init();
|
||||
UFUNCTION(BlueprintCallable, Category = "ApartmentManager")
|
||||
UResComApartmentManager* GetApartmentManager() const;
|
||||
|
||||
|
||||
|
||||
//UFUNCTION(BlueprintCallable)
|
||||
//void HttpGet(FString UrlAddress, const FHttpDelegate& Callback);
|
||||
//void OnHttpRequestComplete(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful);
|
||||
@@ -0,0 +1,26 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "ResComPoint.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class FORTIS_TAKTIKA_API AResComPoint : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
AResComPoint();
|
||||
|
||||
protected:
|
||||
// Called when the game starts or when spawned
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user